NumberFormatInfo.NativeDigits Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets a string array of native digits equivalent to the Western digits 0 through 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()
Property Value
A string array that contains the native equivalent of the Western digits 0 through 9. The default is an array having the elements "0", "1", "2", "3", "4", "5", "6", "7", "8", and "9".
- Attributes
Exceptions
The current NumberFormatInfo object is read-only.
In a set operation, the value is null
.
-or-
In a set operation, an element of the value array is null
.
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.
Examples
The following example demonstrates the NativeDigits property.
// 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"
'
Remarks
Important
The character set that's specified by the NativeDigits property has no effect on parsing or formatting operations. Only the Basic Latin digits 0 (U+0030) through 9 (U+0039) are used when formatting or parsing numeric values or date and time values.