本文整理汇总了C#中Decimal.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Decimal.ToString方法的具体用法?C# Decimal.ToString怎么用?C# Decimal.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Decimal
的用法示例。
在下文中一共展示了Decimal.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteCurrency
private void WriteCurrency(Decimal value, int length, TdsParserStateObject stateObj)
{
SqlMoney m = new SqlMoney(value);
int[] bits = Decimal.GetBits(m.Value);
// this decimal should be scaled by 10000 (regardless of what the incoming decimal was scaled by)
bool isNeg = (0 != (bits[3] & unchecked((int)0x80000000)));
long l = ((long)(uint)bits[1]) << 0x20 | (uint)bits[0];
if (isNeg)
l = -l;
if (length == 4)
{
// validate the value can be represented as a small money
if (value < TdsEnums.SQL_SMALL_MONEY_MIN || value > TdsEnums.SQL_SMALL_MONEY_MAX)
{
throw SQL.MoneyOverflow(value.ToString(CultureInfo.InvariantCulture));
}
WriteInt((int)l, stateObj);
}
else
{
WriteInt((int)(l >> 0x20), stateObj);
WriteInt((int)l, stateObj);
}
}
示例2: GenerateDecimalValue
protected virtual void GenerateDecimalValue (Decimal d)
{
Output.Write (d.ToString (CultureInfo.InvariantCulture));
}
示例3: ToString
///<include file='doc\XmlConvert.uex' path='docs/doc[@for="XmlConvert.ToString2"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public static string ToString(Decimal value)
{
return value.ToString(null, NumberFormatInfo.InvariantInfo);
}
示例4: ParameterValueOutOfRange
static internal ArgumentException ParameterValueOutOfRange(Decimal value)
{
return ADP.Argument(Res.GetString(Res.ADP_ParameterValueOutOfRange, value.ToString((IFormatProvider)null)));
}