NumberFormatInfo.NativeDigits Proprietà

Definizione

Ottiene o imposta una matrice di stringhe di cifre native equivalenti ai numeri europei da 0 a 9.

public:
 property cli::array <System::String ^> ^ NativeDigits { cli::array <System::String ^> ^ get(); void set(cli::array <System::String ^> ^ value); };
public string[] NativeDigits { get; set; }
[System.Runtime.InteropServices.ComVisible(false)]
public string[] NativeDigits { get; set; }
member this.NativeDigits : string[] with get, set
[<System.Runtime.InteropServices.ComVisible(false)>]
member this.NativeDigits : string[] with get, set
Public Property NativeDigits As String()

Valore della proprietà

String[]

Matrice di stringhe che contiene l'equivalente nativo delle cifre europee da 0 a 9. L'impostazione predefinita è una matrice i cui elementi sono "0", "1", "2", "3", "4", "5", "6", "7", "8" e "9".

Attributi

Eccezioni

L'oggetto NumberFormatInfo corrente è di sola lettura.

In un'operazione set il valore è null.

-oppure-

In un'operazione set un elemento della matrice di valori è null.

In un'operazione set la matrice di valori non contiene 10 elementi.

-oppure-

In un'operazione set un elemento della matrice di valori non contiene un singolo oggetto Char o una coppia di oggetti Char che comprende una coppia di surrogati.

-oppure-

In un'operazione set un elemento della matrice di valori non è una cifra numerica come definita dallo standard Unicode. Vale a dire, la cifra nell'elemento di matrice non ha il valore General Category (Nd) di Unicode Number, Decimal Digit.

-oppure-

In un'operazione set il valore numerico di un elemento nella matrice di valori non corrisponde alla posizione dell'elemento nella matrice. Vale a dire, l'elemento in corrispondenza dell'indice 0, che è il primo elemento della matrice, non ha un valore numerico pari a 0 oppure l'elemento in corrispondenza dell'indice 1 non ha un valore numerico pari a 1.

Esempio

Nell'esempio seguente viene illustrata la NativeDigits proprietà .

// This example demonstrates the NativeDigits property.

using namespace System;
using namespace System::Globalization;
using namespace System::Threading;

int main()
{
    CultureInfo^ currentCI = Thread::CurrentThread->CurrentCulture;
    NumberFormatInfo^ nfi = currentCI->NumberFormat;
    array<String^>^ nativeDigitList = nfi->NativeDigits;

    Console::WriteLine("The native digits for the {0} culture are:",
        currentCI->Name);

    for each (String^ nativeDigit in nativeDigitList)
    {
        Console::Write("\"{0}\" ", nativeDigit);
    }

    Console::WriteLine();
}
/*
This code example produces the following results:

The native digits for the en-US culture are:
"0" "1" "2" "3" "4" "5" "6" "7" "8" "9"

*/
// This example demonstrates the NativeDigits property.

using System;
using System.Globalization;
using System.Threading;

class Sample
{
    public static void Main()
    {
    CultureInfo currentCI = Thread.CurrentThread.CurrentCulture;
    NumberFormatInfo nfi = currentCI.NumberFormat;
    string[] nativeDigitList = nfi.NativeDigits;

    Console.WriteLine("The native digits for the {0} culture are:", currentCI.Name);
    foreach (string s in nativeDigitList)
        {
        Console.Write("\"{0}\" ", s);
        }
    Console.WriteLine();
    }
}
/*
This code example produces the following results:

The native digits for the en-US culture are:
"0" "1" "2" "3" "4" "5" "6" "7" "8" "9"

*/
' This example demonstrates the NativeDigits property.

Imports System.Globalization
Imports System.Threading

Class Sample
    Public Shared Sub Main() 
        Dim currentCI As CultureInfo = Thread.CurrentThread.CurrentCulture
        Dim nfi As NumberFormatInfo = currentCI.NumberFormat
        Dim nativeDigitList As String() = nfi.NativeDigits
        
        Console.WriteLine("The native digits for the {0} culture are:", currentCI.Name)
        Dim s As String
        For Each s In  nativeDigitList
            Console.Write("""{0}"" ", s)
        Next s
        Console.WriteLine()
    
    End Sub
End Class

'This code example produces the following results:
'
'The native digits for the en-US culture are:
'"0" "1" "2" "3" "4" "5" "6" "7" "8" "9"
'

Commenti

Importante

Il set di caratteri specificato dalla NativeDigits proprietà non ha alcun effetto sulle operazioni di analisi o formattazione. Solo le cifre latine di base da 0 (U+0030) a 9 (U+0039) vengono utilizzate durante la formattazione o l'analisi di valori numerici o di data e ora.

Si applica a

Vedi anche