Click or drag to resize

ExtensionMethodsTryRemoveItemsOfWrongTypeT1, T2 Method (ListT1, ListT1, Boolean)

Removes the items in a list 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
C#
public static bool TryRemoveItemsOfWrongType<T1, T2>(
	this List<T1> list,
	out List<T1> removedItems,
	bool warnOnRemoval = false
)
where T2 : class

Parameters

list
Type: System.Collections.GenericListT1
The list of the items
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 list.
T2
The type we are checking against.

Return Value

Type: Boolean
True 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 ListT1. 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