SerializationInfo.GetBoolean(String) 方法

定義

SerializationInfo 存放區擷取布林值。Retrieves a Boolean value from the SerializationInfo store.

public:
 bool GetBoolean(System::String ^ name);
public bool GetBoolean (string name);
member this.GetBoolean : string -> bool
Public Function GetBoolean (name As String) As Boolean

參數

name
String

與要擷取的值相關聯的名稱。The name associated with the value to retrieve.

傳回

Boolean

name 相關聯的布林值。The Boolean value associated with name.

例外狀況

namenullname is null.

name 相關聯的數值無法轉換為布林值。The value associated with name cannot be converted to a Boolean value.

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

備註

如果值為布林值,或可以轉換為一個布林值,則會傳回該值;否則會擲回 InvalidCastExceptionIf the value is a Boolean, or can be converted to one, that value is returned; otherwise, a InvalidCastException is thrown. 所有的轉換都是由 IFormatterConverter 與此相關聯的進行 SerializationInfoAll conversions are done by the IFormatterConverter associated with this SerializationInfo.

適用於