Επεξεργασία

Κοινή χρήση μέσω


RegionInfo.CurrencyNativeName Property

Definition

Gets the name of the currency used in the country/region, formatted in the native language of the country/region.

public:
 virtual property System::String ^ CurrencyNativeName { System::String ^ get(); };
public virtual string CurrencyNativeName { get; }
[System.Runtime.InteropServices.ComVisible(false)]
public virtual string CurrencyNativeName { get; }
member this.CurrencyNativeName : string
[<System.Runtime.InteropServices.ComVisible(false)>]
member this.CurrencyNativeName : string
Public Overridable ReadOnly Property CurrencyNativeName As String

Property Value

The native name of the currency used in the country/region, formatted in the language associated with the ISO 3166 country/region code.

Attributes

Examples

The following code example demonstrates the CurrencyNativeName property.

// This example demonstrates the RegionInfo.EnglishName, NativeName,
// CurrencyEnglishName, CurrencyNativeName, and GeoId properties.

using namespace System;
using namespace System::Globalization;

int main()
{
    // Regional Info for Sweden
    RegionInfo^ ri = gcnew RegionInfo("SE");

    Console::WriteLine("Region English Name: . . . {0}", ri->EnglishName);
    Console::WriteLine("Native Name: . . . . . . . {0}", ri->NativeName);
    Console::WriteLine("Currency English Name: . . {0}",
        ri->CurrencyEnglishName);
    Console::WriteLine("Currency Native Name:. . . {0}",
        ri->CurrencyNativeName);
    Console::WriteLine("Geographical ID: . . . . . {0}", ri->GeoId);
}
/*
This code example produces the following results:

Region English Name: . . . Sweden
Native Name: . . . . . . . Sverige
Currency English Name: . . Swedish Krona
Currency Native Name:. . . Svensk krona
Geographical ID: . . . . . 221

*/
// This example demonstrates the RegionInfo.EnglishName, NativeName,
// CurrencyEnglishName, CurrencyNativeName, and GeoId properties.

using System;
using System.Globalization;

class Sample
{
    public static void Main()
    {
    RegionInfo ri = new RegionInfo("SE"); // Sweden

    Console.WriteLine("Region English Name: . . . {0}", ri.EnglishName);
    Console.WriteLine("Native Name: . . . . . . . {0}", ri.NativeName);
    Console.WriteLine("Currency English Name: . . {0}", ri.CurrencyEnglishName);
    Console.WriteLine("Currency Native Name:. . . {0}", ri.CurrencyNativeName);
    Console.WriteLine("Geographical ID: . . . . . {0}", ri.GeoId);
    }
}
/*
This code example produces the following results:

Region English Name: . . . Sweden
Native Name: . . . . . . . Sverige
Currency English Name: . . Swedish Krona
Currency Native Name:. . . Svensk krona
Geographical ID: . . . . . 221

*/
' This example demonstrates the RegionInfo.EnglishName, NativeName,
' CurrencyEnglishName, CurrencyNativeName, and GeoId properties.
Imports System.Globalization

Class Sample
   Public Shared Sub Main()
      Dim ri As New RegionInfo("SE") ' Sweden
      Console.WriteLine("Region English Name: . . . {0}", ri.EnglishName)
      Console.WriteLine("Native Name: . . . . . . . {0}", ri.NativeName)
      Console.WriteLine("Currency English Name: . . {0}", ri.CurrencyEnglishName)
      Console.WriteLine("Currency Native Name:. . . {0}", ri.CurrencyNativeName)
      Console.WriteLine("Geographical ID: . . . . . {0}", ri.GeoId)
   End Sub
End Class
'
'This code example produces the following results:
'
'Region English Name: . . . Sweden
'Native Name: . . . . . . . Sverige
'Currency English Name: . . Swedish Krona
'Currency Native Name:. . . Svensk krona
'Geographical ID: . . . . . 221
'

Remarks

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

The value of this property depends on the language that's associated with a particular country/region. Therefore, if you intend to use the CurrencyNativeName property, you should instantiate the RegionInfo object by passing the RegionInfo(String) constructor a combined language and country/region code. For example, if a RegionInfo object is instantiated with a combined language and country/region code of "en-CA" for English (Canada), the value of its CurrencyNativeName property is "Canadian Dollar". If it is instantiated with a combined language and country/region code of "fr-CA" for French (Canada), the value of its CurrencyNativeName property is "Dollar canadien". Therefore, creating the RegionInfo object with only a country/region name ("CA" in this case) is not specific enough to distinguish the appropriate native currency name.

Applies to