Skip to main content

Class ExtensionMethods

ExtensionMethods class

Assembly: Meadow.Contracts.dll
View Source
Declaration
public static class ExtensionMethods

Methods

Contains<TSource>(IEnumerable<TSource>, TSource[])

Contains static extention method to check if the pattern exists within the source

View Source
Declaration
public static bool Contains<TSource>(this IEnumerable<TSource> source, TSource[] pattern)
Returns

System.Boolean: true if the pattern exists

Parameters
TypeName
System.Collections.Generic.IEnumerable<<TSource>>source
<TSource>[]pattern
Type Parameters
  • TSource

FirstIndexOf<TSource>(IEnumerable<TSource>, TSource[])

FirstIndexOf static extention method for an IEnumerable

View Source
Declaration
public static int FirstIndexOf<TSource>(this IEnumerable<TSource> source, TSource[] pattern)
Returns

System.Int32: the index position of the found pattern

Parameters
TypeName
System.Collections.Generic.IEnumerable<<TSource>>source
<TSource>[]pattern
Type Parameters
  • TSource

Map(float, float, float, float, float)

Maps a source value's position within a range of numbers to the same position within a another range of numbers. For instance, will map a source value of 30 in the range of 0 to 100 to a value of 0.3 in a given range of 0.0 to 1.0.

View Source
Declaration
public static float Map(this float sourceValue, float sourceMin, float sourceMax, float targetMin, float targetMax)
Returns

System.Single

Parameters
TypeNameDescription
System.SinglesourceValueThe value to map to the new domain.
System.SinglesourceMinThe minimum value of the source domain.
System.SinglesourceMaxThe maximum value of the source domain.
System.SingletargetMinThe minimum value of the destination domain.
System.SingletargetMaxThe maximum value of the destination domain.

Map(double, double, double, double, double)

Maps a source value's position within a range of numbers to the same position within a another range of numbers. For instance, will map a source value of 30 in the range of 0 to 100 to a value of 0.3 in a given range of 0.0 to 1.0.

View Source
Declaration
public static double Map(this double sourceValue, double sourceMin, double sourceMax, double targetMin, double targetMax)
Returns

System.Double

Parameters
TypeNameDescription
System.DoublesourceValueThe value to map to the new domain.
System.DoublesourceMinThe minimum value of the source domain.
System.DoublesourceMaxThe maximum value of the source domain.
System.DoubletargetMinThe minimum value of the destination domain.
System.DoubletargetMaxThe maximum value of the destination domain.

Map(int, int, int, int, int)

Maps a source value's position within a range of numbers to the same position within a another range of numbers. For instance, will map a source value of 30 in the range of 0 to 100 to a value of 0.3 in a given range of 0.0 to 1.0.

View Source
Declaration
public static int Map(this int sourceValue, int sourceMin, int sourceMax, int targetMin, int targetMax)
Returns

System.Int32

Parameters
TypeNameDescription
System.Int32sourceValueThe value to map to the new domain.
System.Int32sourceMinThe minimum value of the source domain.
System.Int32sourceMaxThe maximum value of the source domain.
System.Int32targetMinThe minimum value of the destination domain.
System.Int32targetMaxThe maximum value of the destination domain.

Fire(Delegate, params object[])

Traverses the handler's invocation list and invokes each via the EventHandler() method

View Source
Declaration
public static void Fire(this Delegate handler, params object[] args)
Parameters
TypeNameDescription
System.DelegatehandlerThe delegate we are acting upon.
System.Object[]argsThe arguments we want to pass to each delegate.

Fire(EventHandler, object)

Traverses the handler's invocation list and invokes each via the EventHandler() method

View Source
Declaration
public static void Fire(this EventHandler handler, object sender)
Parameters
TypeNameDescription
System.EventHandlerhandlerThe eventhandler we are acting upon.
System.ObjectsenderThe sender object.

Fire(EventHandler, object, EventArgs)

Traverses the handler's invocation list and invokes each via the EventHandler() method

View Source
Declaration
public static void Fire(this EventHandler handler, object sender, EventArgs args)
Parameters
TypeNameDescription
System.EventHandlerhandlerThe eventhandler we are acting upon.
System.ObjectsenderThe sender object.
System.EventArgsargsThe arguments we want to pass to each delegate.

Fire<T>(EventHandler<T>, object, T)

Traverses the handler's invocation list and invokes each via the EventHandler() method

View Source
Declaration
public static void Fire<T>(this EventHandler<T> handler, object sender, T args) where T : EventArgs
Parameters
TypeNameDescription
System.EventHandler<<T>>handlerThe eventhandler we are acting upon.
System.ObjectsenderThe sender object.
<T>argsThe arguments we want to pass to each delegate.
Type Parameters
  • T