本文整理匯總了C#中System.Decimal.Zero字段的典型用法代碼示例。如果您正苦於以下問題:C# Decimal.Zero字段的具體用法?C# Decimal.Zero怎麽用?C# Decimal.Zero使用的例子?那麽, 這裏精選的字段代碼示例或許可以為您提供幫助。您也可以進一步了解該字段所在類System.Decimal
的用法示例。
在下文中一共展示了Decimal.Zero字段的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Main
// Example of the Decimal fields.
using System;
class DecimalFieldsDemo
{
public static void Main( )
{
const string numberFmt = "{0,-25}{1,45:N0}";
const string exprFmt = "{0,-55}{1,15}";
Console.WriteLine(
"This example of the fields of the Decimal structure " +
"\ngenerates the following output.\n" );
Console.WriteLine( numberFmt, "Field or Expression", "Value" );
Console.WriteLine( numberFmt, "-------------------", "-----" );
// Display the values of the Decimal fields.
Console.WriteLine( numberFmt, "Decimal.MaxValue",
Decimal.MaxValue );
Console.WriteLine( numberFmt, "Decimal.MinValue",
Decimal.MinValue );
Console.WriteLine( numberFmt, "Decimal.MinusOne",
Decimal.MinusOne );
Console.WriteLine( numberFmt, "Decimal.One", Decimal.One );
Console.WriteLine( numberFmt, "Decimal.Zero", Decimal.Zero );
Console.WriteLine( );
// Display the values of expressions of the Decimal fields.
Console.WriteLine( exprFmt,
"( Decimal.MinusOne + Decimal.One ) == Decimal.Zero",
(Decimal.MinusOne + Decimal.One ) == Decimal.Zero );
Console.WriteLine( exprFmt,
"Decimal.MaxValue + Decimal.MinValue",
Decimal.MaxValue + Decimal.MinValue );
Console.WriteLine( exprFmt,
"Decimal.MinValue / Decimal.MaxValue",
Decimal.MinValue / Decimal.MaxValue );
Console.WriteLine( "{0,-40}{1,30}",
"100000000000000M / Decimal.MaxValue",
100000000000000M / Decimal.MaxValue );
}
}
輸出:
Field or Expression Value ------------------- ----- Decimal.MaxValue 79,228,162,514,264,337,593,543,950,335 Decimal.MinValue -79,228,162,514,264,337,593,543,950,335 Decimal.MinusOne -1 Decimal.One 1 Decimal.Zero 0 ( Decimal.MinusOne + Decimal.One ) == Decimal.Zero True Decimal.MaxValue + Decimal.MinValue 0 Decimal.MinValue / Decimal.MaxValue -1 100000000000000M / Decimal.MaxValue 0.0000000000000012621774483536