A class with general purpose extensions methods.
More...
|
| static float | Duration (this AnimationCurve curve) |
| | Returns the absolute duration of the curve from first to last key frame More...
|
| |
| static bool | IsValid (this Ray ray) |
| | Determines whether or not a ray is valid. More...
|
| |
| static ReadOnlyCollection< TElement > | AsReadOnly< TElement > (this IList< TElement > elements) |
| | Creates a read-only wrapper around an existing collection. More...
|
| |
| static ReadOnlyCollection< TElement > | ToReadOnlyCollection< TElement > (this IEnumerable< TElement > elements) |
| | Creates a read-only copy of an existing collection. More...
|
| |
| static int | SortedInsert< TElement > (this List< TElement > elements, TElement toInsert, IComparer< TElement > comparer=null) |
| | Inserts an item in its sorted position into an already sorted collection. This is useful if you need to consume the collection in between insertions and need it to stay correctly sorted the whole time. If you just need to insert a bunch of items and then consume the sorted collection at the end, it's faster to add all the elements and then use List<T>.Sort at the end. More...
|
| |
| static void | DisposeElements< TElement > (this IEnumerable< TElement > elements) |
| | Disposes of all non-null elements in a collection. More...
|
| |
| static void | DisposeElements< TElement > (this IList< TElement > elements) |
| | Disposes of all non-null elements in a collection. More...
|
| |
| static bool | Approximately (this float number, float other, float tolerance) |
| | Checks if two numbers are approximately equal. Similar to Mathf.Approximately(float, float), but the tolerance can be specified. More...
|
| |
| static bool | Approximately (this double number, double other, double tolerance) |
| | Checks if two numbers are approximately equal. Similar to Mathf.Approximately(float, float), but the tolerance can be specified. More...
|
| |
| static void | DontDestroyOnLoad (this Object target) |
| |
| static bool | IsInLayerMask (this GameObject gameObject, LayerMask layerMask) |
| | Determines whether or not a game object's layer is included in the specified layer mask. More...
|
| |
| static IComparer< TElement > | GetReversed< TElement > (this IComparer< TElement > originalComparer) |
| | Gets a comparer that sorts elements in the opposite order of the original comparer. More...
|
| |
A class with general purpose extensions methods.
Definition at line 16 of file Extensions.cs.
§ Approximately() [1/2]
| static bool HoloToolkit.Unity.Extensions.Approximately |
( |
this float |
number, |
|
|
float |
other, |
|
|
float |
tolerance |
|
) |
| |
|
static |
Checks if two numbers are approximately equal. Similar to Mathf.Approximately(float, float), but the tolerance can be specified.
- Parameters
-
| number | One of the numbers to compare. |
| other | The other number to compare. |
| tolerance | The amount of tolerance to allow while still considering the numbers approximately equal. |
- Returns
- True if the difference between the numbers is less than or equal to the tolerance, false otherwise.
Definition at line 155 of file Extensions.cs.
§ Approximately() [2/2]
| static bool HoloToolkit.Unity.Extensions.Approximately |
( |
this double |
number, |
|
|
double |
other, |
|
|
double |
tolerance |
|
) |
| |
|
static |
Checks if two numbers are approximately equal. Similar to Mathf.Approximately(float, float), but the tolerance can be specified.
- Parameters
-
| number | One of the numbers to compare. |
| other | The other number to compare. |
| tolerance | The amount of tolerance to allow while still considering the numbers approximately equal. |
- Returns
- True if the difference between the numbers is less than or equal to the tolerance, false otherwise.
Definition at line 168 of file Extensions.cs.
§ AsReadOnly< TElement >()
| static ReadOnlyCollection<TElement> HoloToolkit.Unity.Extensions.AsReadOnly< TElement > |
( |
this IList< TElement > |
elements | ) |
|
|
static |
Creates a read-only wrapper around an existing collection.
- Template Parameters
-
| TElement | The type of element in the collection. |
- Parameters
-
| elements | The collection to be wrapped. |
- Returns
- The new, read-only wrapper around elements .
Definition at line 51 of file Extensions.cs.
§ DisposeElements< TElement >() [1/2]
| static void HoloToolkit.Unity.Extensions.DisposeElements< TElement > |
( |
this IEnumerable< TElement > |
elements | ) |
|
|
static |
Disposes of all non-null elements in a collection.
- Template Parameters
-
| TElement | The type of element in the collection. |
- Parameters
-
| elements | The collection of elements to be disposed. |
Definition at line 112 of file Extensions.cs.
§ DisposeElements< TElement >() [2/2]
| static void HoloToolkit.Unity.Extensions.DisposeElements< TElement > |
( |
this IList< TElement > |
elements | ) |
|
|
static |
Disposes of all non-null elements in a collection.
- Template Parameters
-
| TElement | The type of element in the collection. |
- Parameters
-
| elements | The collection of elements to be disposed. |
Definition at line 129 of file Extensions.cs.
§ DontDestroyOnLoad()
| static void HoloToolkit.Unity.Extensions.DontDestroyOnLoad |
( |
this Object |
target | ) |
|
|
static |
§ Duration()
| static float HoloToolkit.Unity.Extensions.Duration |
( |
this AnimationCurve |
curve | ) |
|
|
static |
Returns the absolute duration of the curve from first to last key frame
- Parameters
-
| curve | The animation curve to check duration of. |
- Returns
- Returns 0 if the curve is null or has less than 1 frame, otherwise returns time difference between first and last frame.
Definition at line 23 of file Extensions.cs.
§ GetReversed< TElement >()
| static IComparer<TElement> HoloToolkit.Unity.Extensions.GetReversed< TElement > |
( |
this IComparer< TElement > |
originalComparer | ) |
|
|
static |
Gets a comparer that sorts elements in the opposite order of the original comparer.
- Template Parameters
-
| TElement | The type of element the comparer compares. |
- Parameters
-
| originalComparer | The comparer whose order should be reversed. |
- Returns
- A comparer that sorts elements in the opposite order of originalComparer .
Definition at line 211 of file Extensions.cs.
§ IsInLayerMask()
| static bool HoloToolkit.Unity.Extensions.IsInLayerMask |
( |
this GameObject |
gameObject, |
|
|
LayerMask |
layerMask |
|
) |
| |
|
static |
Determines whether or not a game object's layer is included in the specified layer mask.
- Parameters
-
| gameObject | The game object whose layer to test. |
| layerMask | The layer mask to test against. |
- Returns
- True if gameObject 's layer is included in layerMask , false otherwise.
Definition at line 195 of file Extensions.cs.
§ IsValid()
| static bool HoloToolkit.Unity.Extensions.IsValid |
( |
this Ray |
ray | ) |
|
|
static |
Determines whether or not a ray is valid.
- Parameters
-
- Returns
- True if the ray is valid, false otherwise.
Definition at line 38 of file Extensions.cs.
§ SortedInsert< TElement >()
| static int HoloToolkit.Unity.Extensions.SortedInsert< TElement > |
( |
this List< TElement > |
elements, |
|
|
TElement |
toInsert, |
|
|
IComparer< TElement > |
comparer = null |
|
) |
| |
|
static |
Inserts an item in its sorted position into an already sorted collection. This is useful if you need to consume the collection in between insertions and need it to stay correctly sorted the whole time. If you just need to insert a bunch of items and then consume the sorted collection at the end, it's faster to add all the elements and then use List<T>.Sort at the end.
- Template Parameters
-
| TElement | The type of element in the collection. |
- Parameters
-
| elements | The collection of sorted elements to be inserted into. |
| toInsert | The element to insert. |
| comparer | The comparer to use when sorting or null to use Comparer<T>.Default. |
- Returns
Definition at line 78 of file Extensions.cs.
§ ToReadOnlyCollection< TElement >()
| static ReadOnlyCollection<TElement> HoloToolkit.Unity.Extensions.ToReadOnlyCollection< TElement > |
( |
this IEnumerable< TElement > |
elements | ) |
|
|
static |
Creates a read-only copy of an existing collection.
- Template Parameters
-
| TElement | The type of element in the collection. |
- Parameters
-
| elements | The collection to be copied. |
- Returns
- The new, read-only copy of elements .
Definition at line 62 of file Extensions.cs.
The documentation for this class was generated from the following file: