Freigeben über


RegionInfo.NativeName Property

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

Gets the name of a country/region formatted in the native language of the country/region.

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

Syntax

'Declaration
<ComVisibleAttribute(False)> _
Public Overridable ReadOnly Property NativeName As String
[ComVisibleAttribute(false)]
public virtual string NativeName { get; }

Property Value

Type: System.String
The native name of the country/region formatted in the language associated with the ISO 3166 country/region code.

Remarks

NoteNote:

The NativeName property retrieves a localized region name if the RegionInfo object is constructed using a full culture name.

Whenever possible, you should use the full culture name, such as "en-US", when instantiating a RegionInfo object, because the string returned by the NativeName property depends on the language associated with the country/region. For example, the cultures "en-US" and "es-US" on Windows Vista can retrieve different values. Therefore, creating the RegionInfo object with only a country/region name, such as "US" in this case, is not specific enough to distinguish the appropriate string.

Examples

The following code example demonstrates the NativeName property.

Imports System.Globalization

Class Example
   Public Shared Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)
      Dim ri As New RegionInfo("sv-SE") ' Sweden

      outputBlock.Text += String.Format("Region English Name: . . . {0}", ri.EnglishName) & vbCrLf
      outputBlock.Text += String.Format("Native Name: . . . . . . . {0}", ri.NativeName) & vbCrLf
      outputBlock.Text += String.Format("Currency Symbol: . . . . . {0} ({1})", _
                                        ri.CurrencySymbol, ri.ISOCurrencySymbol) & vbCrLf
   End Sub
End Class 
' This example produces the following results:
'       Region English Name: . . . Sweden
'       Native Name: . . . . . . . Sverige
'       Currency Symbol: . . . . . kr (SEK)
using System;
using System.Globalization;

class Example
{
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {
      RegionInfo ri = new RegionInfo("sv-SE");   // Sweden

      outputBlock.Text += String.Format("Region English Name: . . . {0}", ri.EnglishName) + "\n";
      outputBlock.Text += String.Format("Native Name: . . . . . . . {0}", ri.NativeName) + "\n";
      outputBlock.Text += String.Format("Currency Symbol: . . . . . {0} ({1})", 
                                        ri.CurrencySymbol, ri.ISOCurrencySymbol) + "\n";
   }
}
/*
This code example produces the following results:
      Region English Name: . . . Sweden
      Native Name: . . . . . . . Sverige
      Currency Native Name:. . . kr (SEK)
*/

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.