NumberFormatInfo.NumberDecimalDigits 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
숫자 값에 사용하는 소수 자릿수를 가져오거나 설정합니다.
public:
property int NumberDecimalDigits { int get(); void set(int value); };
public int NumberDecimalDigits { get; set; }
member this.NumberDecimalDigits : int with get, set
Public Property NumberDecimalDigits As Integer
속성 값
숫자 값에 사용하는 소수 자릿수입니다. InvariantInfo의 기본값은 2입니다.
예외
속성이 0보다 작거나 99보다 큰 값으로 설정됩니다.
속성이 설정되어 있으며 NumberFormatInfo 개체가 읽기 전용입니다.
예제
다음 예제에서는 변경의 효과 보여 줍니다.는 NumberDecimalDigits 속성입니다.
using namespace System;
using namespace System::Globalization;
int main()
{
// Gets a NumberFormatInfo associated with the en-US culture.
CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false );
NumberFormatInfo^ nfi = MyCI->NumberFormat;
// Displays a negative value with the default number of decimal digits (2).
Int64 myInt = -1234;
Console::WriteLine( myInt.ToString( "N", nfi ) );
// Displays the same value with four decimal digits.
nfi->NumberDecimalDigits = 4;
Console::WriteLine( myInt.ToString( "N", nfi ) );
}
/*
This code produces the following output.
-1, 234.00
-1, 234.0000
*/
using System;
using System.Globalization;
class NumberFormatInfoSample {
public static void Main() {
// Gets a NumberFormatInfo associated with the en-US culture.
NumberFormatInfo nfi = new CultureInfo( "en-US", false ).NumberFormat;
// Displays a negative value with the default number of decimal digits (2).
Int64 myInt = -1234;
Console.WriteLine( myInt.ToString( "N", nfi ) );
// Displays the same value with four decimal digits.
nfi.NumberDecimalDigits = 4;
Console.WriteLine( myInt.ToString( "N", nfi ) );
}
}
/*
This code produces the following output.
-1,234.00
-1,234.0000
*/
Imports System.Globalization
Class NumberFormatInfoSample
Public Shared Sub Main()
' Gets a NumberFormatInfo associated with the en-US culture.
Dim nfi As NumberFormatInfo = New CultureInfo("en-US", False).NumberFormat
' Displays a negative value with the default number of decimal digits (2).
Dim myInt As Int64 = - 1234
Console.WriteLine(myInt.ToString("N", nfi))
' Displays the same value with four decimal digits.
nfi.NumberDecimalDigits = 4
Console.WriteLine(myInt.ToString("N", nfi))
End Sub
End Class
'This code produces the following output.
'
'-1,234.00
'-1,234.0000
설명
NumberDecimalDigits 속성은 숫자 서식 지정 작업의에서 전체 자릿수 지정자 없이 "F"와 "N" 표준 서식 문자열을 사용 하 여 사용 합니다. 소수 구분 기호 다음에 표시 되는 소수 자릿수의 기본값을 정의 합니다. 전체 자릿수 지정자를 사용 하는 경우이 값이 재정의 됩니다. 자세한 내용은 표준 숫자 형식 문자열을 참조하세요.