DotNext by .NET Foundation and Contributors

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

 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 bool AreSame<T>(ref T first, ref T second)

Indicates that two managed pointers are equal.

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

Converts typed reference into managed pointer.

public static void Bitcast<T, TResult>(ref T input, out TResult output) where T : ValueType modreq(System.Runtime.InteropServices.UnmanagedType) where TResult : ValueType modreq(System.Runtime.InteropServices.UnmanagedType)

Obtain a value of type TResult by reinterpreting the object representation of T.

public static T Cast<T>(object obj)

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

public static void ClearBits(Void* address, IntPtr length)

Sets all bits of allocated memory to zero.

public static void ClearBits(Void* address, UIntPtr length)

Sets all bits of allocated memory to zero.

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

Bitwise comparison of two memory blocks.

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, long 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 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 T DefaultOf<T>()

Returns default value of the given type.

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

Computes equality between two blocks of memory.

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

Computes equality between two blocks of memory.

public static Exception Error(object obj)

Throws arbitrary object as exception.

public static void Finalize(object obj)

Explicitly invokes object finalizer.

public static int GetHashCode32<T>(Func<T, int, int> getter, int count, T arg, bool salted = true)

Computes 32-bit hash code for the vector.

public static int GetHashCode32(Void* source, IntPtr length, int hash, Func<int, int, int> hashFunction, bool salted = true)

Computes 32-bit hash code for the block of memory.

public static int GetHashCode32(Void* source, UIntPtr length, int hash, Func<int, int, int> hashFunction, bool salted = true)

Computes 32-bit hash code for the block of memory.

public static int GetHashCode32<THashFunction>(Void* source, IntPtr length, bool salted = true) where THashFunction : struct, IConsumer<int>, ISupplier<int>

Computes 32-bit hash code for the block of memory.

public static int GetHashCode32<THashFunction>(Void* source, UIntPtr length, bool salted = true) where THashFunction : struct, IConsumer<int>, ISupplier<int>

Computes 32-bit hash code for the block of memory.

public static int GetHashCode32(Void* source, IntPtr length, bool salted = true)

Computes 32-bit hash code for the block of memory.

public static int GetHashCode32(Void* source, UIntPtr length, bool salted = true)

Computes 32-bit hash code for the block of memory.

public static long GetHashCode64<T>(Func<T, int, long> getter, int count, T arg, bool salted = true)

Computes 64-bit hash code for the vector.

public static long GetHashCode64(Void* source, IntPtr length, long hash, Func<long, long, long> hashFunction, bool salted = true)

Computes 64-bit hash code for the block of memory, 64-bit version.

public static long GetHashCode64(Void* source, UIntPtr length, long hash, Func<long, long, long> hashFunction, bool salted = true)

Computes 64-bit hash code for the block of memory, 64-bit version.

public static long GetHashCode64<THashFunction>(Void* source, IntPtr length, bool salted = true) where THashFunction : struct, IConsumer<long>, ISupplier<long>

Computes 64-bit hash code for the block of memory, 64-bit version.

public static long GetHashCode64<THashFunction>(Void* source, UIntPtr length, bool salted = true) where THashFunction : struct, IConsumer<long>, ISupplier<long>

Computes 64-bit hash code for the block of memory, 64-bit version.

public static long GetHashCode64(Void* source, IntPtr length, bool salted = true)

Computes 64-bit hash code for the block of memory.

public static long GetHashCode64(Void* source, UIntPtr length, bool salted = true)

Computes 64-bit hash code for the block of memory.

public static IntPtr GetLength(Array array)

Gets length of the array.

public static TBase& modreq(System.Runtime.InteropServices.InAttribute) GetReadonlyRef<T, TBase>(this T[] array, IntPtr index) where T : TBase

Allows to reinterpret managed pointer to array element.

public static bool HasFinalizer(object obj)

Determines whether the object overrides Finalize method.

public static bool HasFlag<T>(T value, T flag) where T : struct, Enum

Determines whether one or more bit fields are set in the given value.

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 Reverse<T>(ref T value) where T : ValueType modreq(System.Runtime.InteropServices.UnmanagedType)

Reverse bytes in the specified value of blittable type.

public static T ShallowCopy<T>(T obj)

Creates shallow copy of the given object.

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 void Throw(object obj)

Throws arbitrary object as exception.

public static void ThrowIfNull<T>(ref T value)

Throws NullReferenceException if given managed pointer is null.

public static RuntimeTypeHandle TypeOf<T>()

Returns the runtime handle associated with type T.