Click or drag to resize

ExtensionMethods Class

Class containing utilities to reduce boilerplate code. It's really just a random assortment of goodies.
Inheritance Hierarchy
SystemObject
  DustProductions.CoreExtensionMethods

Namespace:  DustProductions.Core
Assembly:  DustProductions.Core (in DustProductions.Core.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public static class ExtensionMethods

The ExtensionMethods type exposes the following members.

Methods
  NameDescription
Public methodStatic memberAddNoDuplicatesT(ListT, ListT)
Add only unique items to a list.
Public methodStatic memberAddNoDuplicatesT(ListT, T)
Add only unique items to a list.
Public methodStatic memberAddNoDuplicatesT(ListT, T)
Add only unique items to a list.
Public methodStatic memberAnnounceComponentAdded
Notifies any IComponentHandlers on the GameObject a Component is added to, that the Component has been added.
Public methodStatic memberCheckIfGameObjectHasComponentOfTypeT
Determines if a GameObject has at least one Component of a certain type already on it.
Public methodStatic memberContainsAnythingT
Builds on IsNullOrEmpty() by also checking the items in the array itself to see if they are null.
Public methodStatic memberDuplicate(GameObject, Boolean, Boolean)
Creates a clone of a gameobject.
Public methodStatic memberDuplicateT(T, Boolean, Boolean)
Clones a generic type.
Public methodStatic memberEnsureEnding
A quick way to make sure a string ends with another string
Public methodStatic memberIsApproximately
Check to see if a float is close to another.
Public methodStatic memberIsNullOrEmptyT(IEnumerableT)
Extension method for checking if any enumerable is null or empty. Not as fast as the array check.
Public methodStatic memberIsNullOrEmptyT(ListT)
Extension method for quickly checking if a list is null or empty.
Public methodStatic memberIsNullOrEmptyT(T)
Extension method for quickly checking if an array is null or empty.
Public methodStatic memberIsWithinRange
Check to see if a float is within of the bounds passed in.
Public methodStatic memberIsWithinRangeExclusive
Check to see if a float is inside of the bounds passed in.
Public methodStatic memberIsWithinRangeInclusive
Check to see if a float is within of the bounds passed in.
Public methodStatic memberPause
Pauses an array of AudioSources.
Public methodStatic memberPlay
Plays an array of AudioSources.
Public methodStatic memberPlayDelayed
Plays an array of AudioSources after a delay.
Public methodStatic memberPlayOneShot
Plays an array of AudioSources one time (without looping).
Public methodStatic memberPlayScheduled
Plays an array of AudioSources at a certain time.
Public methodStatic memberRoundToNearest(Int32, Int32)
Rounds a number where you can specify the precision of the rounding
Public methodStatic memberRoundToNearest(Single, Int32)
Rounds a number where you can specify the precision of the rounding
Public methodStatic memberRoundToNearest(Single, Single)
Rounds a number where you can specify the precision of the rounding
Public methodStatic memberSetActive
Helper to set an array of GameObjects active or inactive
Public methodStatic memberSetEnabled(ListBehaviour, Boolean)
Helper to set a list of Behaviours active or inactive.
Public methodStatic memberSetEnabled(Behaviour, Boolean)
Helper to set an array of Behaviours active or inactive.
Public methodStatic memberStartCoroutineT
Use by calling this.StartCoroutine and assigning it to a Coroutine. Then you can call your assigned coroutine.Cancel(), or .HasFinished, or a variety of other neat things.
Public methodStatic memberStop
Stops an array of AudioSources.
Public methodStatic memberTrim
Removes a string from the front and end of another string.
Public methodStatic memberTrimEnd
Removes a string from the end of another string.
Public methodStatic memberTrimStart
Removes a string from the beginning of another string.
Public methodStatic memberTryAddAtFirstNullT
Attempts to add an item to an array in the first spot it can find that's null.
Public methodStatic memberTryAddComponentT
Attempts to add a component to a GameObject. This can fail if there is already a component of some type on the GameObject, and only one is allowed.
Public methodStatic memberTryGetComponentT(Component, T, Boolean)
Attempts to get a component on a gameobject.
Public methodStatic memberTryGetComponentT(GameObject, T, Boolean)
Attempts to get a component on a gameobject.
Public methodStatic memberTryGetComponentT1, T2(Component, T1, Boolean)
Attempts to get a component on a gameobject.
Public methodStatic memberTryGetComponentT1, T2(GameObject, T1, Boolean)
Attempts to get a component on a gameobject.
Public methodStatic memberTryGetComponentsT(Component, T, Boolean)
Attempts to get components on a gameobject.
Public methodStatic memberTryGetComponentsT(GameObject, T, Boolean)
Attempts to get components on a GameObject.
Public methodStatic memberTryGetComponentsT(GameObject, ListT, Boolean)
Searches an array of GameObjects for a certain Type of Component. Can also add it if it doesn't exist.
Public methodStatic memberTryGetComponentsT1, T2(Component, T1, Boolean)
Attempts to get components on a gameobject.
Public methodStatic memberTryGetComponentsT1, T2(GameObject, T1, Boolean)
Attempts to get components on a GameObject.
Public methodStatic memberTryGetComponentsT1, T2(GameObject, ListT1, Boolean)
Searches an array of GameObjects for a certain Type of Component. Can also add it if it doesn't exist.
Public methodStatic memberTryGetRootParentTypeT
Attempts to get the uppermost type of an object in a GameObject tree.
Public methodStatic memberTryRemoveItemsOfWrongTypeT1, T2(ListT1, Boolean)
Removes the items in a list that don't match or inherit from the type specified. Will also remove null items.
Public methodStatic memberTryRemoveItemsOfWrongTypeT1, T2(ListT1, ListT1, Boolean)
Removes the items in a list that don't match or inherit from the type specified. Will also remove null items.
Public methodStatic memberTryRemoveItemsOfWrongTypeT1, T2(T1, T1, Boolean)
Removes the items in an array that don't match or inherit from the type specified. Will also remove null items.
Public methodStatic memberTryRemoveItemsOfWrongTypeT1, T2(T1, T1, ListT1, Boolean)
Removes the items in an array that don't match or inherit from the type specified. Will also remove null items.
Public methodStatic memberTryRemoveNullItemsT
Clean up null values inside of lists.
Public methodStatic memberUnPause
UnPauses an array of AudioSources.
Top
See Also