2013-07-03 2 views

ответ

0

Вы можете использовать ToString() перегрузки, что позволяет культуре быть указан.

// Use the culture you desire instead of en-US 
culture = CultureInfo.CreateSpecificCulture("en-US"); 
Console.WriteLine(value.ToString(specifier, culture)); 

http://msdn.microsoft.com/en-us/library/d8ztz0sa.aspx

0

Посмотрите на эту ссылку:

http://msdn.microsoft.com/en-us/library/system.globalization.numberformatinfo.currencygroupseparator.aspx

Вы можете изменить образец кода и вывода, указав формат числа и CurrencyGroupSeparator

using System; 
using System.Globalization; 

class NumberFormatInfoSample { 

    public static void Main() { 

     // Gets a NumberFormatInfo associated with the en-US culture. 
     NumberFormatInfo nfi = new CultureInfo("en-US", false).NumberFormat; 

     // Displays a value with the default separator (","). 
     Int64 myInt = 123456789; 
     Console.WriteLine(myInt.ToString("N0", nfi)); 

     // Displays the same value with a specified separator. 
     nfi.CurrencyGroupSeparator = "."; 
     Console.WriteLine(myInt.ToString("N0", nfi)); 

    } 
} 


/* 
This code produces the following output. 

123,456,789 
123.456.789 
*/ 
Смежные вопросы