NumberFormatInfo.NativeDigits Propriedade

Definição

Obtém ou define uma matriz de cadeia de caracteres de dígitos nativos equivalentes aos dígitos ocidentais de 0 a 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 da propriedade

String[]

Uma matriz de cadeia de caracteres que contém o equivalente nativo dos dígitos ocidentais de 0 a 9. O padrão é uma matriz com os elementos “0”, “1”, “2”, “3”, “4”, “5”, “6”, “7”, “8” e “9”.

Atributos

Exceções

O objeto NumberFormatInfo atual é somente leitura.

Em uma operação de conjuntos, o valor é null.

  • ou - Em uma operação de conjuntos, um elemento da matriz de valores é null.

Em uma operação de conjuntos, a matriz de valores não contém 10 elementos.

  • ou - Em uma operação de conjuntos, um elemento da matriz de valores não contém um único objeto Char nem um par de objetos Char que compõem um par alternativo.

  • ou - Em uma operação de definição, um elemento da matriz de valor não é um dígito de número conforme definido pelo Padrão Unicode. Ou seja, o dígito no elemento de matriz não tem o valor Number, Decimal Digit Unicode de Categoria Geral (Nd).

  • ou - Em uma operação de conjuntos, o valor numérico de um elemento da matriz de valores não corresponde à posição do elemento na matriz. Ou seja, o elemento no índice 0, que é o primeiro elemento da matriz, não tem um valor numérico igual a 0 ou o elemento no índice 1 não tem um valor numérico igual a 1.

Exemplos

O exemplo a seguir demonstra a NativeDigits propriedade.

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

Comentários

Importante

O conjunto de caracteres especificado pela NativeDigits propriedade não tem nenhum efeito sobre as operações de análise ou de formatação. Somente os dígitos latinos básicos 0 (U + 0030) a 9 (U + 0039) são usados ao Formatar ou analisar valores numéricos ou valores de data e hora.

Aplica-se a

Confira também