SerializationInfo.GetSingle(String) SerializationInfo.GetSingle(String) SerializationInfo.GetSingle(String) SerializationInfo.GetSingle(String) Method

定義

SerializationInfo 存放區擷取單精確度浮點數值。Retrieves a single-precision floating-point value from the SerializationInfo store.

public:
 float GetSingle(System::String ^ name);
public float GetSingle (string name);
member this.GetSingle : string -> single
Public Function GetSingle (name As String) As Single

參數

name
String String String String

要擷取的值的名稱。The name of the value to retrieve.

傳回

name 相關聯的單精確度浮點數值。The single-precision floating-point value associated with name.

例外狀況

name 相關聯的數值無法轉換為單精確度浮點數值。The value associated with name cannot be converted to a single-precision floating-point value.

在目前的執行個體中找不到具有指定名稱的項目。An element with the specified name is not found in the current instance.

備註

如果值是單精確度浮點數, 或可以轉換成 1, 則會傳回該值;否則, InvalidCastException就會擲回。If the value is a single-precision floating-point number, or can be converted to one, that value is returned; otherwise, a InvalidCastException is thrown. 所有的轉換都是由IFormatterConverter與這個SerializationInfo相關聯的所完成。All conversions are done by the IFormatterConverter associated with this SerializationInfo.

適用於