Redigera

Dela via


Unsafe.Read<T>(Void*) Method

Definition

Important

This API is not CLS-compliant.

Reads a value of type T from the given location.

public:
generic <typename T>
 static T Read(void* source);
public static T Read<T> (void* source);
[System.CLSCompliant(false)]
public static T Read<T> (void* source);
static member Read : nativeptr<unit> -> 'T
[<System.CLSCompliant(false)>]
static member Read : 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.

source is assumed to be a properly aligned pointer to a value of type T. For more information on alignment assumptions, see ECMA-335, Sec. I.12.6.2 ("Alignment").

Applies to