Freigeben über


RegionInfo.CurrencySymbol Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the currency symbol associated with the country/region.

Namespace:  System.Globalization
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Overridable ReadOnly Property CurrencySymbol As String
public virtual string CurrencySymbol { get; }

Property Value

Type: System.String
The currency symbol associated with the country/region.

Remarks

For example, the currency symbol for the United States is "$".

If the current RegionInfo object is created with a specific culture and more than one language is used in the corresponding country/region, the CurrencySymbol property returns the currency symbol associated with the specific culture.

Examples

The following code example displays the properties of the RegionInfo class.

Imports System.Globalization

Public Class Example
   Public Shared Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)
      ' Displays the property values of the RegionInfo for "US".
      Dim myRI1 As New RegionInfo("en-US")
      outputBlock.Text += String.Format("   Name:                         {0}", myRI1.Name) & vbCrLf
      outputBlock.Text += String.Format("   DisplayName:                  {0}", myRI1.DisplayName) & vbCrLf
      outputBlock.Text += String.Format("   EnglishName:                  {0}", myRI1.EnglishName) & vbCrLf
      outputBlock.Text += String.Format("   IsMetric:                     {0}", myRI1.IsMetric) & vbCrLf
      outputBlock.Text += String.Format("   TwoLetterISORegionName:       {0}", myRI1.TwoLetterISORegionName) & vbCrLf
      outputBlock.Text += String.Format("   CurrencySymbol:               {0}", myRI1.CurrencySymbol) & vbCrLf
      outputBlock.Text += String.Format("   ISOCurrencySymbol:            {0}", myRI1.ISOCurrencySymbol) & vbCrLf
   End Sub 
End Class 
' This example produces the following output.
'       Name:                         US
'       DisplayName:                  United States
'       EnglishName:                  United States
'       IsMetric:                     False
'       TwoLetterISORegionName:       US
'       CurrencySymbol:               $
'       ISOCurrencySymbol:            USD
using System;
using System.Globalization;

public class Example
{
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {
      // Displays the property values of the RegionInfo for "US".
      RegionInfo myRI1 = new RegionInfo("en-US");
      outputBlock.Text += String.Format("   Name:                         {0}\n", myRI1.Name);
      outputBlock.Text += String.Format("   DisplayName:                  {0}\n", myRI1.DisplayName);
      outputBlock.Text += String.Format("   EnglishName:                  {0}\n", myRI1.EnglishName);
      outputBlock.Text += String.Format("   IsMetric:                     {0}\n", myRI1.IsMetric);
      outputBlock.Text += String.Format("   TwoLetterISORegionName:       {0}\n", myRI1.TwoLetterISORegionName);
      outputBlock.Text += String.Format("   CurrencySymbol:               {0}\n", myRI1.CurrencySymbol);
      outputBlock.Text += String.Format("   ISOCurrencySymbol:            {0}\n", myRI1.ISOCurrencySymbol);
   }
}
/*
This code produces the following output.
   Name:                         US
   DisplayName:                  United States
   EnglishName:                  United States
   IsMetric:                     False
   TwoLetterISORegionName:       US
   CurrencySymbol:               $
   ISOCurrencySymbol:            USD
*/

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.