NumberFormatInfo.CurrencySymbol Property

Definition

Gets or sets the string to use as the currency symbol.

public:
 property System::String ^ CurrencySymbol { System::String ^ get(); void set(System::String ^ value); };
public string CurrencySymbol { get; set; }
member this.CurrencySymbol : string with get, set
Public Property CurrencySymbol As String

Property Value

The string to use as the currency symbol. The default for InvariantInfo is "¤".

Exceptions

The property is being set to null.

The property is being set and the NumberFormatInfo object is read-only.

Examples

The following example displays the currency symbol for the current culture and uses the "C" standard numeric format string to format a currency value.

using System;
using System.Globalization;

public class Example
{
   public static void Main()
   {
      Decimal value = 106.25m;
      Console.WriteLine("Current Culture: {0}",
                        CultureInfo.CurrentCulture.Name);
      Console.WriteLine("Currency Symbol: {0}",
                        NumberFormatInfo.CurrentInfo.CurrencySymbol);
      Console.WriteLine("Currency Value:  {0:C2}", value);
   }
}
// The example displays the following output:
//       Current Culture: en-US
//       Currency Symbol: $
//       Currency Value:  $106.25
Imports System.Globalization
Imports System.Threading

Module Example
   Public Sub Main()
      Dim value As Decimal = 106.25d
      Console.WriteLine("Current Culture: {0}",
                        CultureInfo.CurrentCulture.Name)
      Console.WriteLine("Currency Symbol: {0}",
                        NumberFormatInfo.CurrentInfo.CurrencySymbol)
      Console.WriteLine("Currency Value:  {0:C2}", value)
   End Sub
End Module
' The example displays output like the following:
'       Current Culture: en-US
'       Currency Symbol: $
'       Currency Value:  $106.25

Remarks

The string assigned to the CurrencySymbol property is included in the result string when a numeric value is formatted with the "C" standard numeric format string.

Applies to

See also