[]
        
(Showing Draft Content)

C1.Util.DX.DXUtil

DXUtil Class

Utility class.

Inheritance
DXUtil
Namespace: C1.Util.DX
Assembly: C1.Win.C1DX.4.8.dll
Syntax
public static class DXUtil

Fields

Name Description
ToDegrees

The multiplier for conversion from radians to degrees.

ToRadians

The multiplier for conversion from degrees to radians.

ZeroTolerance

The value for which all absolute numbers smaller than are considered equal to zero.

Methods

Name Description
AllocateClearedMemory(int, byte, int)

Allocate an aligned memory buffer and clear it with a specified value (0 by default).

AllocateMemory(int, int)

Allocate an aligned memory buffer.

Any<T>(IEnumerable<T>)

Test if there is an element in this enumeration.

Array<T>(T, int)

Creates an Array of count elements with the given value.

BuildPropertyGetter<T>(Type, PropertyInfo)

Builds a fast property getter from a type and a property info.

BuildPropertySetter<T>(Type, PropertyInfo)

Builds a fast property setter from a type and a property info.

Clamp(int, int, int)

Clamps the specified value.

Clamp(float, float, float)

Clamps the specified value.

ClearMemory(IntPtr, byte, int)

Clears the memory.

Compare(IEnumerator, IEnumerator)

Compares two collection, element by elements.

CompareMemory(IntPtr, IntPtr, int)

Compares two block of memory.

ConvertToBoolArray(Bool[])

Converts Bool array to bool array.

CopyMemory(IntPtr, IntPtr, int)

Native memcpy.

Dispose<T>(ref T)

Safely dispose a referencem if not null, and set it to null after dispose.

Distinct<TSource>(IEnumerable<TSource>, IEqualityComparer<TSource>)

Selects distinct elements from an enumeration.

FreeDisposedShadowPointers()

Releases native pointers to already disposed shadow objects.

FreeMemory(IntPtr)

Allocate an aligned memory buffer.

GetCustomAttribute<T>(MemberInfo, bool)

Gets the custom attribute.

GetCustomAttributes<T>(MemberInfo, bool)

Gets the custom attributes.

GetGuidFromType(Type)

Gets the Guid from a type.

IsAssignableFrom(Type, Type)

Determines whether fromType can be assigned to toType.

IsEnum(Type)

Determines whether the specified type to test is an enum.

IsOne(float)

Determines whether the specified value is close to one (1.0f).

IsValueType(Type)

Determines whether the specified type to test is a value type.

IsZero(float)

Determines whether the specified value is close to zero (0.0f).

Join(string, IEnumerator)

String helper join method to display an enumrable of object as a single string.

Lerp(double, double, double)

Interpolates between two values using a linear function by a given amount.

Lerp(float, float, float)

Interpolates between two values using a linear function by a given amount.

NearEqual(float, float)

Checks if a and b are almost equals, taking into account the magnitude of floating point numbers. See Remarks. See remarks.

Pin<T>(ref T, Action<IntPtr>)

Pins the specified source and call an action with the pinned pointer.

Pin<T>(T[], Action<IntPtr>)

Pins the specified source and call an action with the pinned pointer.

PtrToStringUni(IntPtr, int)

Converts a pointer to a null-terminating string up to maxLength characters to a .Net string.

ReadAndPosition<T>(IntPtr, ref T)

Reads the specified T data from a memory location.

ReadOut<T>(IntPtr, out T)

Reads the specified T data from a memory location.

ReadStream(Stream, ref int)

Read stream to a byte[] buffer.

Read<T>(IntPtr)

Reads the specified T data from a memory location.

Read<T>(IntPtr, ref T)

Reads the specified T data from a memory location.

Read<T>(IntPtr, T[], int, int)

Reads the specified array T[] data from a memory location.

SelectMany<TSource, TResult>(IEnumerable<TSource>, Func<TSource, IEnumerable<TResult>>)

Select elements from an enumeration.

SizeOf<T>()

Return the sizeof a struct from a CLR. Equivalent to sizeof operator but works on generics too.

SizeOf<T>(T[])

Return the sizeof an array of struct. Equivalent to sizeof operator but works on generics too.

Sleep(TimeSpan)

Suspends the current thread.

StringToHGlobalAnsi(string)

Copies the contents of a managed String into unmanaged memory, converting into ANSI format as it copies.

StringToHGlobalUni(string)

Copies the contents of a managed String into unmanaged memory.

ToArray<T>(IEnumerable<T>)

Transforms an IEnumerable<T> to an array of T.

ToByteArray<T>(T[])

Converts a structured array to an equivalent byte array.

WithinEpsilon(float, float, float)

Checks if a - b are almost equals within a float epsilon.

WriteAndPosition<T>(IntPtr, ref T)

Writes the specified T data to a memory location.

Write<T>(IntPtr, ref T)

Writes the specified T data to a memory location.

Write<T>(IntPtr, T[], int, int)

Writes the specified array T[] data to a memory location.