Export (0) Print
Expand All

NumberFormatInfo.NativeDigits Property

Note: This property is new in the .NET Framework version 2.0.

Gets or sets a string array of native digits equivalent to the Western digits 0 through 9.

Namespace: System.Globalization
Assembly: mscorlib (in mscorlib.dll)

[ComVisibleAttribute(false)] 
public string[] NativeDigits { get; set; }
/** @property */
public String[] get_NativeDigits ()

/** @property */
public void set_NativeDigits (String[] value)

public function get NativeDigits () : String[]

public function set NativeDigits (value : String[])

Property Value

An array of type String that contains the native equivalent of the Western digits 0 through 9. The default is an array whose elements are "0", "1", "2", "3", "4", "5", "6", "7", "8", and "9".

Exception typeCondition

InvalidOperationException

The current NumberFormatInfo object is read-only.

ArgumentNullException

In a set operation, the value is a null reference (Nothing in Visual Basic).

-or-

In a set operation, an element of the value array is a null reference (Nothing in Visual Basic).

ArgumentException

In a set operation, the value array does not contain 10 elements.

-or-

In a set operation, an element of the value array does not contain either a single Char object or a pair of Char objects that comprise a surrogate pair.

-or-

In a set operation, an element of the value array is not a number digit as defined by the Unicode standard. That is, the digit in the array element does not have the Unicode Number, Decimal Digit (Nd) General Category value.

-or-

In a set operation, the numeric value of an element in the value array does not correspond to the element's position in the array. That is, the element at index 0, which is the first element of the array, does not have a numeric value of 0; or the element at index 1 does not have a numeric value of 1; and so on.

The following code example demonstrates the NativeDigits property.

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

*/

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft