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 個の要素がありません。

または

設定操作で、値配列の要素に、1 つの Char オブジェクトも、サロゲート ペアを構成する Char オブジェクトのペアも含まれていません。

または

設定操作で、値配列の要素が Unicode 規格で定義された数字ではありません。 つまり、配列要素中の数字は Unicode Number, Decimal Digit (Nd) General Category 値を持ちません。

または

設定操作で、値配列内の要素の数値は配列内の要素の位置に対応していません。 つまり、配列の 1 番目であるインデックス 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) のみが使用されます。

適用対象

こちらもご覧ください