| ExtensionMethodsTryRemoveItemsOfWrongTypeT1, T2 Method (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.
Namespace:
DustProductions.Core
Assembly:
DustProductions.Core (in DustProductions.Core.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax public static bool TryRemoveItemsOfWrongType<T1, T2>(
this T1[] array,
ref T1[] cleanedArray,
out List<T1> removedItems,
bool warnOnRemoval = false
)
where T2 : class
Parameters
- array
- Type: T1
The array of items to check - cleanedArray
- Type: T1
A new array without objects of type T2 in them - removedItems
- Type: System.Collections.GenericListT1
A list of the items that were removed from the array - warnOnRemoval (Optional)
- Type: SystemBoolean
Whether or not to display a debug message when removing items of the wrong type (not including null)
Type Parameters
- T1
- The type of the items in the array.
- T2
- The type we are checking against.
Return Value
Type:
BooleanTrue if the removal is successful, false otherwise.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type . When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
See Also