NumberFormatInfo.NativeDigits Propiedad

Definición

Obtiene o establece una matriz de cadenas de dígitos nativos equivalentes a los dígitos occidentales del 0 al 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()

Valor de propiedad

String[]

Matriz de cadena que contiene los dígitos nativos equivalentes a los dígitos occidentales del 0 al 9. El valor predeterminado es una matriz con los elementos "0", "1", "2", "3", "4", "5", "6", "7", "8" y "9".

Atributos

Excepciones

El objeto NumberFormatInfo actual es de solo lectura.

En una operación Set, el valor es null.

o bien

En una operación Set, un elemento de la matriz de valores es null.

En una operación Set, la matriz de valores no contiene 10 elementos.

o bien

En una operación Set, un elemento de la matriz de valores no contiene un único objeto Char o un par de objetos Char que componen un par suplente.

o bien

En una operación Set, un elemento de la matriz de valores no es un dígito numérico como el definido por el estándar Unicode. Es decir, el dígito del elemento de matriz no contiene el valor de categoría general de Unicode Number, Decimal Digit (Nd).

O bien

En una operación Set, el valor numérico de un elemento de la matriz de valores no se corresponde con la posición del elemento en la matriz. Es decir, el elemento del índice 0, que es el primer elemento de la matriz, no tiene un valor numérico de 0, o el elemento del índice 1 no tiene un valor numérico de 1.

Ejemplos

En el ejemplo siguiente se muestra la NativeDigits propiedad .

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

Comentarios

Importante

El juego de caracteres especificado por la NativeDigits propiedad no tiene ningún efecto en las operaciones de análisis o formato. Solo se usan los dígitos latinos básicos 0 (U+0030) a 9 (U+0039) al dar formato o analizar valores numéricos o valores de fecha y hora.

Se aplica a

Consulte también