Class SetOrderEnumerator<T>
A class that enumerates a collection into a given order of mutually exclusive sets
Inherited Members
Namespace: LemonEdge.Utils
Assembly: LemonEdge.Utils.dll
Syntax
public class SetOrderEnumerator<T> : IEnumerable<T>, IEnumerable, IEnumerator<T>, IEnumerator, IDisposable
Type Parameters
Name | Description |
---|---|
T | The type of items being enumerated |
Remarks
The sets are definied as an ordered collection of functions that return if an item of type
T
belongs in the set or not.
As such an item must belong to one, and only one, set - these must be mutually exclusive sets
For example:
public IEnumerable<int> GetMyInts()
{
var myItems = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8 };
var mySets = new List<Func<int, bool>>()
{
(int i) => i % 2 != 0, //odd
(int i) => i % 2 == 0 //even
};
return new SetOrderEnumerator<int>(myItems, mySets);
}
Will return:
1,3,5,7,2,4,6,8
Constructors
SetOrderEnumerator(IEnumerable<T>, IEnumerable<Func<T, bool>>)
Constructs a new SetOrderEnumerator<T> that can enumerate the given collections into ordered sets
Declaration
public SetOrderEnumerator(IEnumerable<T> items, IEnumerable<Func<T, bool>> sets)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | items | The items to be enumerated |
IEnumerable<Func<T, bool>> | sets | An ordered collection of functions defining if an item of type |
Properties
Current
Current Implementation. Returns current item in enumeration
Declaration
public T Current { get; }
Property Value
Type | Description |
---|---|
T |
Methods
Dispose()
Declaration
public void Dispose()
Dispose(bool)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing |
GetEnumerator()
GetEnumerator() Implementation
Declaration
public IEnumerator<T> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<T> |
MoveNext()
MoveNext() Implementation. Moves to next item in the enumeration
Declaration
public bool MoveNext()
Returns
Type | Description |
---|---|
bool |
Reset()
Reset() Implementation. Resets the current enumeration
Declaration
public void Reset()