Click or drag to resize

SafeNativeMemoryT Class

Represents a wrapper class for a buffer allocated with AllocHGlobal(Int32) and the size of T.
Inheritance Hierarchy
SystemObject
  System.Runtime.ConstrainedExecutionCriticalFinalizerObject
    System.Runtime.InteropServicesSafeHandle
      TomsToolbox.DesktopSafeNativeMemory
        TomsToolbox.DesktopSafeNativeMemoryT

Namespace:  TomsToolbox.Desktop
Assembly:  TomsToolbox.Desktop (in TomsToolbox.Desktop.dll) Version: 1.0.74.0
Syntax
public class SafeNativeMemory<T> : SafeNativeMemory

Type Parameters

T

The SafeNativeMemoryT type exposes the following members.

Constructors
  NameDescription
Public methodSafeNativeMemoryT
Initializes a new instance of the SafeNativeMemoryT class.
Public methodSafeNativeMemoryT(Int32)
Initializes a new instance of the SafeNativeMemoryT class.
Top
Properties
  NameDescription
Public propertyIsInvalid
When overridden in a derived class, gets a value indicating whether the handle value is invalid.
(Inherited from SafeNativeMemory.)
Public propertySize
Gets the size of the allocated buffer.
(Inherited from SafeNativeMemory.)
Top
Methods
  NameDescription
Public methodAllocate
Allocates a buffer with the specified size.
(Inherited from SafeNativeMemory.)
Public methodReadInt32
Reads a 32-bit signed integer from unmanaged memory.
(Inherited from SafeNativeMemory.)
Public methodReadIntPtr
Reads a processor native sized integer from unmanaged memory.
(Inherited from SafeNativeMemory.)
Protected methodReleaseHandle
When overridden in a derived class, executes the code required to free the handle.
(Inherited from SafeNativeMemory.)
Public methodToStructure
Marshal the memory from native to .NET.

[CanBeNull]

Top
Operators
Extension Methods
  NameDescription
Public Extension MethodSafeCastT
Performs a cast from object to T, avoiding possible null violations if T is a value type.

[CanBeNull]

(Defined by ObjectExtensions.)
Top
See Also