SerializationInfo.GetDecimal(String) 方法

定义

SerializationInfo 存储中检索一个十进制值。Retrieves a decimal value from the SerializationInfo store.

public:
 System::Decimal GetDecimal(System::String ^ name);
public decimal GetDecimal (string name);
member this.GetDecimal : string -> decimal
Public Function GetDecimal (name As String) As Decimal

参数

name
String

与要检索的值关联的名称。The name associated with the value to retrieve.

返回

SerializationInfo 中的十进制值。A decimal value from the SerializationInfo.

异常

namenullname is null.

name 关联的值不能转换为十进制值。The value associated with name cannot be converted to a decimal.

当前实例中没有找到具有指定名称的元素。An element with the specified name is not found in the current instance.

注解

如果该值为 decimal 或可转换为十进制,则返回该值;否则,会引发 InvalidCastExceptionIf the value is a decimal, or can be converted to a decimal, that value is returned; otherwise, a InvalidCastException is thrown. 所有转换都是通过与此 SerializationInfo相关联的 IFormatterConverter 来完成的。All conversions are done by the IFormatterConverter associated with this SerializationInfo.

适用于