AlgorithmsPartitionT Method |
Partition a list or array based on a predicate. After partitioning, all items for which
the predicate returned true precede all items for which the predicate returned false.
Namespace: X3Platform.CollectionsAssembly: X3Platform.Support (in X3Platform.Support.dll) Version: 1.0.0.0 (2.0.0.0)
Syntaxpublic static int Partition<T>(
IList<T> list,
Predicate<T> predicate
)
public:
generic<typename T>
static int Partition(
IList<T>^ list,
Predicate<T>^ predicate
)
Parameters
- list
- Type: System.Collections.GenericIListT
The list or array to partition. - predicate
- Type: SystemPredicateT
A delegate that defines the partitioning condition.
Type Parameters
- T
[Missing <typeparam name="T"/> documentation for "M:X3Platform.Collections.Algorithms.Partition``1(System.Collections.Generic.IList{``0},System.Predicate{``0})"]
Return Value
Type:
Int32The index of the first item in the second half of the partition; i.e., the first item for
which
predicate returned false. If the predicate was true for all items
in the list, list.Count is returned.
RemarksAlthough arrays cast to IList<T> are normally read-only, this method
will work correctly and modify an array passed as list.
See Also