SafeMemoryMappedViewHandle 類別

定義

提供安全控制代碼,表示隨機存取的 Unmanaged 記憶體區塊檢視。Provides a safe handle that represents a view of a block of unmanaged memory for random access.

public ref class SafeMemoryMappedViewHandle sealed : System::Runtime::InteropServices::SafeBuffer
public sealed class SafeMemoryMappedViewHandle : System.Runtime.InteropServices.SafeBuffer
[System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)]
public sealed class SafeMemoryMappedViewHandle : System.Runtime.InteropServices.SafeBuffer
type SafeMemoryMappedViewHandle = class
    inherit SafeBuffer
[<System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)>]
type SafeMemoryMappedViewHandle = class
    inherit SafeBuffer
Public NotInheritable Class SafeMemoryMappedViewHandle
Inherits SafeBuffer
繼承
SafeMemoryMappedViewHandle
繼承
屬性

備註

使用 MemoryMappedViewAccessor.SafeMemoryMappedViewHandle 屬性來取得安全控制碼。Use the MemoryMappedViewAccessor.SafeMemoryMappedViewHandle property to obtain the safe handle.

重要

此型別代表 IDisposable 介面。This type implements the IDisposable interface. 當您完成使用型別時,您應該直接或間接處置它。When you have finished using the type, you should dispose of it either directly or indirectly. 若要直接處置型別,請呼叫其 try/catch 區塊中的 Dispose 方法。To dispose of the type directly, call its Dispose method in a try/catch block. 若要間接處置它,請使用語言建構函式,例如 using (在 C# 中) 或 Using (在 Visual Basic 中)。To dispose of it indirectly, use a language construct such as using (in C#) or Using (in Visual Basic). 如需詳細資訊,請參閱 IDisposable 介面文章中的<使用實作 IDisposable 的物件>一節。For more information, see the "Using an Object that Implements IDisposable" section in the IDisposable interface topic.

欄位

handle

指定要包裝的控制代碼。Specifies the handle to be wrapped.

(繼承來源 SafeHandle)

屬性

ByteLength

取得緩衝區的大小,以位元組為單位。Gets the size of the buffer, in bytes.

(繼承來源 SafeBuffer)
IsClosed

取得值,指出控制代碼是否已關閉。Gets a value indicating whether the handle is closed.

(繼承來源 SafeHandle)
IsInvalid

取得值,表示控制代碼是否無效。Gets a value that indicates whether the handle is invalid.

(繼承來源 SafeBuffer)

方法

AcquirePointer(Byte*)

SafeBuffer 物件取得記憶體區塊的指標。Obtains a pointer from a SafeBuffer object for a block of memory.

(繼承來源 SafeBuffer)
Close()

標記要釋出和釋放資源的控制代碼。Marks the handle for releasing and freeing resources.

(繼承來源 SafeHandle)
DangerousAddRef(Boolean)

手動遞增 SafeHandle 執行個體上的參考計數器。Manually increments the reference counter on SafeHandle instances.

(繼承來源 SafeHandle)
DangerousGetHandle()

傳回 handle 欄位的值。Returns the value of the handle field.

(繼承來源 SafeHandle)
DangerousRelease()

手動遞減 SafeHandle 執行個體上的參考計數器。Manually decrements the reference counter on a SafeHandle instance.

(繼承來源 SafeHandle)
Dispose()

釋放 SafeHandle 類別使用的所有資源。Releases all resources used by the SafeHandle class.

(繼承來源 SafeHandle)
Dispose(Boolean)

釋放 SafeHandle 類別所使用的 Unmanaged 資源,指定是否要執行一般處置作業。Releases the unmanaged resources used by the SafeHandle class specifying whether to perform a normal dispose operation.

(繼承來源 SafeHandle)
Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetHashCode()

作為預設雜湊函數。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
Initialize(UInt32, UInt32)

使用指定的項目數目和項目大小,指定記憶體緩衝區的配置大小。Specifies the allocation size of the memory buffer by using the specified number of elements and element size. 您必須先呼叫這個方法,才能夠使用 SafeBuffer 執行個體。You must call this method before you use the SafeBuffer instance.

(繼承來源 SafeBuffer)
Initialize(UInt64)

定義記憶體區域的配置大小 (以位元組為單位)。Defines the allocation size of the memory region in bytes. 您必須先呼叫這個方法,才能夠使用 SafeBuffer 執行個體。You must call this method before you use the SafeBuffer instance.

(繼承來源 SafeBuffer)
Initialize<T>(UInt32)

指定實值型別的數目,定義記憶體區域的配置大小。Defines the allocation size of the memory region by specifying the number of value types. 您必須先呼叫這個方法,才能夠使用 SafeBuffer 執行個體。You must call this method before you use the SafeBuffer instance.

(繼承來源 SafeBuffer)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
Read<T>(UInt64)

從記憶體中指定的位移讀取實值型別。Reads a value type from memory at the specified offset.

(繼承來源 SafeBuffer)
ReadArray<T>(UInt64, T[], Int32, Int32)

從記憶體中的位移開始讀取指定數目的實值型別,並從陣列中的索引處開始寫入。Reads the specified number of value types from memory starting at the offset, and writes them into an array starting at the index.

(繼承來源 SafeBuffer)
ReleaseHandle()

在衍生類別中覆寫時,執行釋放控制代碼所需的程式碼。When overridden in a derived class, executes the code required to free the handle.

(繼承來源 SafeHandle)
ReleasePointer()

釋放 AcquirePointer(Byte*) 方法所取得的指標。Releases a pointer that was obtained by the AcquirePointer(Byte*) method.

(繼承來源 SafeBuffer)
SetHandle(IntPtr)

將控制代碼設定為指定的既有控制代碼。Sets the handle to the specified pre-existing handle.

(繼承來源 SafeHandle)
SetHandleAsInvalid()

將控制代碼標記為不再使用。Marks a handle as no longer used.

(繼承來源 SafeHandle)
ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)
Write<T>(UInt64, T)

將實值型別寫入至記憶體中指定的位置。Writes a value type to memory at the given location.

(繼承來源 SafeBuffer)
WriteArray<T>(UInt64, T[], Int32, Int32)

先從輸入陣列中指定的位置開始讀取位元組,再將指定數目的實值型別寫入至記憶體位置。Writes the specified number of value types to a memory location by reading bytes starting from the specified location in the input array.

(繼承來源 SafeBuffer)

適用於