Unsafe.ReadUnaligned Method

Definition

Overloads

ReadUnaligned<T>(Void*)

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

ReadUnaligned<T>(Byte)

Reads a value of type T from the given address without assuming architecture dependent alignment of the source address.

ReadUnaligned<T>(Void*)

Source:
Unsafe.cs
Source:
Unsafe.cs
Source:
Unsafe.cs

Important

This API is not CLS-compliant.

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

public:
generic <typename T>
 static T ReadUnaligned(void* source);
public static T ReadUnaligned<T> (void* source);
[System.CLSCompliant(false)]
public static T ReadUnaligned<T> (void* source);
static member ReadUnaligned : nativeptr<unit> -> 'T
[<System.CLSCompliant(false)>]
static member ReadUnaligned : nativeptr<unit> -> 'T

Type Parameters

T

The type of the value to read.

Parameters

source
Void*

An unmanaged pointer containing the address to read from.

Returns

T

A value of type T read from the given location.

Attributes

Remarks

Caution

The caller must ensure that there are SizeOf<T>() bytes of readable memory available starting at the location pointed to by source. Access violations may occur if this requirement is not met.

Applies to

ReadUnaligned<T>(Byte)

Source:
Unsafe.cs
Source:
Unsafe.cs
Source:
Unsafe.cs

Reads a value of type T from the given address without assuming architecture dependent alignment of the source address.

public:
generic <typename T>
 static T ReadUnaligned(System::Byte % source);
public static T ReadUnaligned<T> (ref byte source);
static member ReadUnaligned : byte -> 'T
Public Shared Function ReadUnaligned(Of T) (ByRef source As Byte) As T

Type Parameters

T

The type of the value to read.

Parameters

source
Byte

A managed pointer containing the address to read from.

Returns

T

A value of type T read from the given address.

Remarks

Caution

The caller must ensure that there are SizeOf<T>() bytes of readable memory available starting at the location pointed to by source. Access violations may occur if this requirement is not met.

Applies to