Condividi tramite


RegionInfo.NativeName Proprietà

Definizione

Ottiene il nome di un paese/area geografica formattato nella lingua nativa del paese/area geografica.

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

Valore della proprietà

Nome nativo del paese/area geografica formattato nella lingua associata al codice paese/area geografica ISO 3166.

Attributi

Esempio

Nell'esempio di codice seguente viene illustrata la NativeName proprietà .

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

Commenti

Annotazioni

La NativeName proprietà recupera un nome di impostazioni cultura completo se l'oggetto RegionInfo viene costruito utilizzando un nome di impostazioni cultura completo.

È consigliabile usare il nome delle impostazioni cultura, ad esempio "en-US" per l'inglese (Stati Uniti) per accedere alla NativeName proprietà. La stringa usata per questa proprietà dipende dalla lingua associata al paese o all'area geografica. Ad esempio, i nomi en-US delle impostazioni cultura per l'inglese (Stati Uniti) e es-US per lo spagnolo (Stati Uniti) possono recuperare valori diversi in Windows. Pertanto, la creazione dell'oggetto RegionInfo con solo un nome paese/area geografica di US non è sufficiente per distinguere la stringa appropriata.

Si applica a