Unsafe Unsafe Unsafe Unsafe Class

Definition

Contains generic, low-level functionality for manipulating pointers.

public ref class Unsafe abstract sealed
public static class Unsafe
type Unsafe = class
Public Class Unsafe
Inheritance
UnsafeUnsafeUnsafeUnsafe

Methods

Add<T>(Void*, Int32) Add<T>(Void*, Int32) Add<T>(Void*, Int32) Add<T>(Void*, Int32)
Add<T>(T, Int32) Add<T>(T, Int32) Add<T>(T, Int32) Add<T>(T, Int32)

Adds an element offset to the given reference.

Add<T>(T, IntPtr) Add<T>(T, IntPtr) Add<T>(T, IntPtr) Add<T>(T, IntPtr)

Adds an element offset to the given reference.

AddByteOffset<T>(T, IntPtr) AddByteOffset<T>(T, IntPtr) AddByteOffset<T>(T, IntPtr) AddByteOffset<T>(T, IntPtr)

Adds a byte offset to the given reference.

AreSame<T>(T, T) AreSame<T>(T, T) AreSame<T>(T, T) AreSame<T>(T, T)

Determines whether the specified references point to the same location.

As<T>(Object) As<T>(Object) As<T>(Object) As<T>(Object)

Casts the given object to the specified type.

As<TFrom,TTo>(TFrom) As<TFrom,TTo>(TFrom) As<TFrom,TTo>(TFrom) As<TFrom,TTo>(TFrom)

Reinterprets the given reference as a reference to a value of type TTo.

AsPointer<T>(T) AsPointer<T>(T) AsPointer<T>(T) AsPointer<T>(T)

Returns a pointer to the given by-ref parameter.

AsRef<T>(T) AsRef<T>(T) AsRef<T>(T) AsRef<T>(T)

Reinterprets the given read-only reference as a reference.

AsRef<T>(Void*) AsRef<T>(Void*) AsRef<T>(Void*) AsRef<T>(Void*)

Reinterprets the given location as a reference to a value of type T.

ByteOffset<T>(T, T) ByteOffset<T>(T, T) ByteOffset<T>(T, T) ByteOffset<T>(T, T)

Determines the byte offset from origin to target from the given references.

Copy<T>(Void*, T) Copy<T>(Void*, T) Copy<T>(Void*, T) Copy<T>(Void*, T)

Copies a value of type T to the given location.

Copy<T>(T, Void*) Copy<T>(T, Void*) Copy<T>(T, Void*) Copy<T>(T, Void*)

Copies a value of type T to the given location.

CopyBlock(Byte, Byte, UInt32) CopyBlock(Byte, Byte, UInt32) CopyBlock(Byte, Byte, UInt32) CopyBlock(Byte, Byte, UInt32)

Copies bytes from the source address to the destination address.

CopyBlock(Void*, Void*, UInt32) CopyBlock(Void*, Void*, UInt32) CopyBlock(Void*, Void*, UInt32) CopyBlock(Void*, Void*, UInt32)

Copies bytes from the source address to the destination address.

CopyBlockUnaligned(Byte, Byte, UInt32) CopyBlockUnaligned(Byte, Byte, UInt32) CopyBlockUnaligned(Byte, Byte, UInt32) CopyBlockUnaligned(Byte, Byte, UInt32)

Copies bytes from the source address to the destination address without assuming architecture dependent alignment of the addresses.

CopyBlockUnaligned(Void*, Void*, UInt32) CopyBlockUnaligned(Void*, Void*, UInt32) CopyBlockUnaligned(Void*, Void*, UInt32) CopyBlockUnaligned(Void*, Void*, UInt32)

Copies bytes from the source address to the destination address without assuming architecture dependent alignment of the addresses.

InitBlock(Void*, Byte, UInt32) InitBlock(Void*, Byte, UInt32) InitBlock(Void*, Byte, UInt32) InitBlock(Void*, Byte, UInt32)

Initializes a block of memory at the given location with a given initial value.

InitBlock(Byte, Byte, UInt32) InitBlock(Byte, Byte, UInt32) InitBlock(Byte, Byte, UInt32) InitBlock(Byte, Byte, UInt32)

Initializes a block of memory at the given location with a given initial value.

InitBlockUnaligned(Byte, Byte, UInt32) InitBlockUnaligned(Byte, Byte, UInt32) InitBlockUnaligned(Byte, Byte, UInt32) InitBlockUnaligned(Byte, Byte, UInt32)

Initializes a block of memory at the given location with a given initial value without assuming architecture dependent alignment of the address.

InitBlockUnaligned(Void*, Byte, UInt32) InitBlockUnaligned(Void*, Byte, UInt32) InitBlockUnaligned(Void*, Byte, UInt32) InitBlockUnaligned(Void*, Byte, UInt32)

Initializes a block of memory at the given location with a given initial value without assuming architecture dependent alignment of the address.

IsAddressGreaterThan<T>(T, T) IsAddressGreaterThan<T>(T, T) IsAddressGreaterThan<T>(T, T) IsAddressGreaterThan<T>(T, T)
IsAddressLessThan<T>(T, T) IsAddressLessThan<T>(T, T) IsAddressLessThan<T>(T, T) IsAddressLessThan<T>(T, T)
Read<T>(Void*) Read<T>(Void*) Read<T>(Void*) Read<T>(Void*)

Reads a value of type T from the given location.

ReadUnaligned<T>(Byte) ReadUnaligned<T>(Byte) ReadUnaligned<T>(Byte) ReadUnaligned<T>(Byte)

Reads a value of type T from the given location without assuming architecture dependent alignment of the addresses.

ReadUnaligned<T>(Void*) ReadUnaligned<T>(Void*) ReadUnaligned<T>(Void*) ReadUnaligned<T>(Void*)

Reads a value of type T from the given location without assuming architecture dependent alignment of the addresses.

SizeOf<T>() SizeOf<T>() SizeOf<T>() SizeOf<T>()

Returns the size of an object of the given type parameter.

Subtract<T>(Void*, Int32) Subtract<T>(Void*, Int32) Subtract<T>(Void*, Int32) Subtract<T>(Void*, Int32)
Subtract<T>(T, Int32) Subtract<T>(T, Int32) Subtract<T>(T, Int32) Subtract<T>(T, Int32)

Subtracts an element offset from the given reference.

Subtract<T>(T, IntPtr) Subtract<T>(T, IntPtr) Subtract<T>(T, IntPtr) Subtract<T>(T, IntPtr)

Subtracts an element offset from the given reference.

SubtractByteOffset<T>(T, IntPtr) SubtractByteOffset<T>(T, IntPtr) SubtractByteOffset<T>(T, IntPtr) SubtractByteOffset<T>(T, IntPtr)

Subtracts a byte offset from the given reference.

Unbox<T>(Object) Unbox<T>(Object) Unbox<T>(Object) Unbox<T>(Object)

Returns a mutable ref to a boxed value.

Write<T>(Void*, T) Write<T>(Void*, T) Write<T>(Void*, T) Write<T>(Void*, T)

Writes a value of type T to the given location.

WriteUnaligned<T>(Byte, T) WriteUnaligned<T>(Byte, T) WriteUnaligned<T>(Byte, T) WriteUnaligned<T>(Byte, T)

Writes a value of type T to the given location without assuming architecture dependent alignment of the addresses.

WriteUnaligned<T>(Void*, T) WriteUnaligned<T>(Void*, T) WriteUnaligned<T>(Void*, T) WriteUnaligned<T>(Void*, T)

Writes a value of type T to the given location without assuming architecture dependent alignment of the addresses.

Applies to