RegionInfo.CurrencyNativeName 属性
定义
获取该国家/地区中使用的货币名称,它使用该国家/地区的本地语言格式表示。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
属性值
该国家/地区中使用的货币的本地名称,它使用与 ISO 3166 国家/地区代码关联的语言格式表示。The native name of the currency used in the country/region, formatted in the language associated with the ISO 3166 country/region code.
- 属性
示例
下面的代码示例演示了 CurrencyNativeName 属性。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::Clear();
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.Clear();
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.Clear()
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
'
注解
如果使用 RegionInfo 特定区域性创建当前对象,并在相应的国家/地区中使用多种语言,则 CurrencyNativeName 属性检索与特定区域性关联的货币名称。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 is associated with a particular country/region. 因此,如果要使用 CurrencyNativeName 属性,则应 RegionInfo 通过 RegionInfo(String) 将构造函数传递成组合语言和国家/地区代码来实例化对象。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. 例如,如果 RegionInfo 使用英语 (加拿大) 的组合语言和国家/地区代码对对象进行实例化,则其属性的值 CurrencyNativeName 为 "加拿大元"。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". 如果使用用于法语 (加拿大) 的组合语言和国家/地区代码对其进行实例化,则其属性的值 CurrencyNativeName 为 "canadien"。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". 因此, RegionInfo 在这种情况下,仅使用国家/地区名称创建对象 ( "CA") 不一定足以区分适当的本机货币名称。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.