UnmanagedMarshal 類別

定義

警告

An alternate API is available: Emit the MarshalAs custom attribute instead. http://go.microsoft.com/fwlink/?linkid=14202

代表描述如何將欄位從受管理程式碼編入非受管理程式碼的類別。 此類別無法獲得繼承。

public ref class UnmanagedMarshal sealed
[System.Serializable]
public sealed class UnmanagedMarshal
[System.Serializable]
[System.Obsolete("An alternate API is available: Emit the MarshalAs custom attribute instead. http://go.microsoft.com/fwlink/?linkid=14202")]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class UnmanagedMarshal
[<System.Serializable>]
type UnmanagedMarshal = class
[<System.Serializable>]
[<System.Obsolete("An alternate API is available: Emit the MarshalAs custom attribute instead. http://go.microsoft.com/fwlink/?linkid=14202")>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type UnmanagedMarshal = class
Public NotInheritable Class UnmanagedMarshal
繼承
UnmanagedMarshal
屬性

備註

程式碼範例展示了這種過時型別的解決方法。

編組是將參數打包與拆包的過程,使遠端程序呼叫能夠發生。 在編組過程中,當受管理型別的格式與對應的非受管型別格式不同時,欄位可能會進行格式轉換。 例如,你可能想將一個 String 類型編入為未管理的 BSTR。 部分格式轉換由執行時自動處理。 要覆寫預設行為,你必須使用 該 UnmanagedMarshal 類別來定義格式轉換。

屬性

名稱 Description
BaseType
已淘汰.

會有一個未管理的基地類型。 這個屬性是唯讀的。

ElementCount
已淘汰.

有數字元素。 這個屬性是唯讀的。

GetUnmanagedType
已淘汰.

表示未管理型態。 這個屬性是唯讀的。

IIDGuid
已淘汰.

會獲得一個GUID。 這個屬性是唯讀的。

方法

名稱 Description
DefineByValArray(Int32)
已淘汰.

指定一個固定長度的陣列(ByValArray)來將程式封接到非管理程式。

DefineByValTStr(Int32)
已淘汰.

指定固定陣列緩衝區(ByValTStr)中的字串,將字串封入非管理程式碼。

DefineLPArray(UnmanagedType)
已淘汰.

指定一個 LPArray to marshal 到非管理程式碼。 的 LPArray 長度在執行時由實際編組陣列的大小決定。

DefineSafeArray(UnmanagedType)
已淘汰.

指定 a SafeArray to marshal to unmanaged code。

DefineUnmanagedMarshal(UnmanagedType)
已淘汰.

指定一個要被編組到非管理程式碼的類型。

Equals(Object)
已淘汰.

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()
已淘汰.

做為預設哈希函式。

(繼承來源 Object)
GetType()
已淘汰.

取得目前實例的 Type

(繼承來源 Object)
MemberwiseClone()
已淘汰.

建立目前 Object的淺層複本。

(繼承來源 Object)
ToString()
已淘汰.

傳回表示目前 物件的字串。

(繼承來源 Object)

適用於

另請參閱