NumberFormatInfo.NativeDigits Właściwość

Definicja

Pobiera lub ustawia tablicę ciągów cyfr natywnych równoważnych cyfrom zachodnim od 0 do 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()

Wartość właściwości

String[]

Tablica ciągów zawierająca natywny odpowiednik cyfr zachodnich od 0 do 9. Wartością domyślną jest tablica mająca elementy "0", "1", "2", "3", "4", "5", "6", "7", "8" i "9".

Atrybuty

Wyjątki

Bieżący NumberFormatInfo obiekt jest tylko do odczytu.

W operacji zestawu wartość to null .

-lub- W operacji zestawu element tablicy wartości to null .

W operacji zestawu tablica wartości nie zawiera 10 elementów.

-lub- W operacji zestawu element tablicy wartości nie zawiera ani pojedynczego obiektu, ani pary obiektów, które składają się Char Char na parę zastępczą.

-lub- W operacji zestawu element tablicy wartości nie jest cyfrą liczbową zdefiniowaną przez standard Unicode. Oznacza to, że cyfra w elemencie tablicy nie ma wartości Unicode Number, Decimal Digit (Nd) General Category.

-lub- W operacji zestawu wartość liczbowa elementu w tablicy wartości nie odpowiada pozycji elementu w tablicy. Oznacza to, że element w indeksie 0, który jest pierwszym elementem tablicy, nie ma wartości liczbowej 0 lub element w indeksie 1 nie ma wartości liczbowej 1.

Przykłady

W poniższym przykładzie pokazano NativeDigits właściwość .

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

Uwagi

Ważne

Zestaw znaków określony przez właściwość nie ma wpływu na NativeDigits operacje analizowania ani formatowania. Podczas formatowania lub analizowania wartości liczbowych lub wartości daty i godziny są używane tylko podstawowe cyfry łaciński od 0 (U+0030) do 9 (U+0039).

Dotyczy

Zobacz też