RegionInfo.CurrencyNativeName 属性

定义

获取该国家/地区中使用的货币名称,它使用该国家/地区的本地语言格式表示。

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 国家/地区代码关联的语言格式表示。

属性

示例

下面的代码示例演示 了 CurrencyNativeName 属性。

// 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
'

注解

如果当前 RegionInfo 对象是使用特定区域性创建的,并且相应国家/地区使用了多种语言,则 CurrencyNativeName 属性将检索与特定区域性关联的货币名称。

此属性的值取决于与特定国家/地区关联的语言。 因此,如果要使用 CurrencyNativeName 属性,则应通过向构造函数传递RegionInfo(String)组合语言和国家/地区代码来实例化RegionInfo对象。 例如,如果 RegionInfo 对象使用英语 (加拿大) 的“en-CA”组合语言和国家/地区代码实例化,则其 CurrencyNativeName 属性的值为“加元”。 如果将其实例化为法语 (加拿大) 的“fr-CA”组合语言和国家/地区代码,则其 CurrencyNativeName 属性的值为“Dollar canadien”。 因此,在本例中,创建 RegionInfo 仅具有国家/地区名称 (“CA”的对象) 不够具体,无法区分相应的本机货币名称。

适用于