SerializationInfo.GetUInt16(String) SerializationInfo.GetUInt16(String) SerializationInfo.GetUInt16(String) SerializationInfo.GetUInt16(String) Method

定義

重要

此 API 不符合 CLS 規範。

SerializationInfo 存放區擷取 16 位元不帶正負號的整數值。Retrieves a 16-bit unsigned integer value from the SerializationInfo store.

public:
 System::UInt16 GetUInt16(System::String ^ name);
[System.CLSCompliant(false)]
public ushort GetUInt16 (string name);
member this.GetUInt16 : string -> uint16
Public Function GetUInt16 (name As String) As UShort

參數

name
String String String String

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

傳回

name 建立關聯的 16 位元不帶正負號的整數。The 16-bit unsigned integer associated with name.

例外狀況

name 相關聯的值無法轉換為 16 位元不帶正負號的整數。The value associated with name cannot be converted to a 16-bit unsigned integer.

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

備註

如果值為16位不帶正負號的整數, 或可以轉換成一個, 則會傳回該值;否則, InvalidCastException就會擲回。If the value is a 16-bit unsigned integer, 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.

適用於