Class Leap::CSharpExtensions

class Leap.CSharpExtensions

Various C# extensions used by the Leap C# classes.

Since

3.0

Public Static Functions

static bool NearlyEquals (this float a, float b, float epsilon = Constants.EPSILON)

Compares whether two floating point numbers are within an epsilon value of each other.

Since

3.0

static bool HasMethod (this object objectToCheck, string methodName)

Reports whether this object has the specified method.

Since

3.0

static int indexOf (this Enum enumItem)

Returns the ordinal index of this enumeration item.

Since

3.0

static T itemFor<T> (this int ordinal)

Gets the item at the ordinal position in this enumeration.

Since

3.0

static void Dispatch<T> (this EventHandler<T> handler, object sender, T eventArgs)

Convenience function to consolidate event dispatching boilerplate code.

Since

3.0

static void DispatchOnContext<T> (this EventHandler<T> handler, object sender, Threading.SynchronizationContext context, T eventArgs)

Convenience function to consolidate event dispatching boilerplate code. Events are dispatched on the message queue of a threads’ synchronization context, if possible.

Since

3.0

class Constants