DotNext by .NET Foundation and Contributors

<PackageReference Include="DotNext" Version="5.14.0" />

 Intrinsics

public static class Intrinsics
Represents highly optimized runtime intrinsic methods.
public static IntPtr AddressOf<T>(ref T value)

Returns an address of the given by-ref parameter.

public static int AlignOf<T>()

Gets the alignment requirement for type T, in bytes.

public static bool AreCompatible<T1, T2>()

Determines whether the two types are binary compatible, i.e. both types have the same size and memory alignment.

public static ref T AsRef<T>(this TypedReference reference)

Converts typed reference into managed pointer.

public static T Cast<T>(object obj)

Provides unified behavior of type cast for reference and value types.

public static int Compare(Void* first, Void* second, UIntPtr length)

Bitwise comparison of two memory blocks.

public static void Copy<T>(ref T input, out T output) where T : struct

Copies one value into another.

public static void Copy<T>(T* input, T* output) where T : ValueType modreq(System.Runtime.InteropServices.UnmanagedType)

Copies one value into another.

public static void Copy<T>(ref T source, out T destination, UIntPtr count) where T : ValueType modreq(System.Runtime.InteropServices.UnmanagedType)

Copies the specified number of elements from source address to the destination address.

public static void CopyUnaligned<T>(T* input, T* output) where T : ValueType modreq(System.Runtime.InteropServices.UnmanagedType)

Copies one value into another assuming unaligned memory access.

public static bool Equals(Void* first, Void* second, UIntPtr length)

Computes equality between two blocks of memory.

public static UIntPtr GetLength(this Array array)

Gets length of the array.

public static bool HasFinalizer(object obj)

Determines whether the object overrides Finalize method.

public static bool IsDefault<T>(ref T value)

Indicates that specified value type is the default value.

public static bool IsExactTypeOf<T>(object obj)

Checks whether the specified object is exactly of the specified type.

public static bool IsNullable<T>()

Provides the fast way to check whether the specified type accepts null value as valid value.

public static int PointerHashCode(Void* pointer)

Computes transient hash code of the specified pointer.

public static void Swap<T>(ref T first, ref T second)

Swaps two values.

public static void Swap<T>(T* first, T* second) where T : ValueType modreq(System.Runtime.InteropServices.UnmanagedType)

Swaps two values.

public static RuntimeTypeHandle TypeOf<T>()

Returns the runtime handle associated with type T.