Writting on Regional Settings

F

Felipe T.

Hi,
I can get the Decimal Digit Separator of the regional Settings using
System.Globalization.NumberFormatInfo.CurrentInfo.CurrencyDecimalDigits().

Actually, i can get any info about the regional settings, but i dont know a
way to write on it.

Anyone knows a way?
 
S

Sandeep Prabhakar [MSFT]

This sample code might help...

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 negative value with the default number of decimal
digits (2).
Int64 myInt = -1234;
Console.WriteLine( myInt.ToString( "C", nfi ) );

// Displays the same value with four decimal digits.
nfi.CurrencyDecimalDigits = 4;
Console.WriteLine( myInt.ToString( "C", nfi ) );

}
}


/*
This code produces the following output.

($1,234.00)
($1,234.0000)
*/

Thanks,
Sandy

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top