NumberFormatInfo.NativeDigits Свойство

Определение

Возвращает или задает массив строк собственных цифр, эквивалентных арабским цифрам от 0 до 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()

Значение свойства

String[]

Массив строк, содержащий собственный эквивалент арабских цифр от 0 до 9. Значение по умолчанию — массив, включающий элементы "0", "1", "2", "3", "4", "5", "6", "7", "8" и "9".

Атрибуты

Исключения

Текущий объект NumberFormatInfo доступен только для чтения.

В операции задания значением является null.

-или-

В операции над множеством элемент массива значений является null.

В операции над множеством массив значений не содержит 10 элементов.

-или-

В операции над множеством элемент массива значений не содержит ни один объект Char, ни пару объектов Char, составляющих суррогатную пару.

-или-

В операции над множеством элемент массива значений не является цифрой, как определено стандартом Юникода. То есть цифра в элементе массива не имеет значения общей категории Юникода Number, Decimal Digit (Nd).

-или-

В операции над множеством числовое значение элемента в массиве значений не соответствует положению элемента в массиве. То есть элемент с индексом 0, который является первым элементом массива, не имеет числового значения 0, или элемент с индексом 1 не имеет числового значения 1.

Примеры

В следующем примере демонстрируется NativeDigits свойство .

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

Комментарии

Важно!

Набор символов, заданный свойством NativeDigits , не влияет на операции синтаксического анализа или форматирования. При форматировании или анализе числовых значений или значений даты и времени используются только латинские цифры от 0 (U+0030) до 9 (U+0039).

Применяется к

См. также раздел