The Encodian population engine provides features to perform common manipulations on a collection (Iterable). These features mimic the extension methods provided by IEnumerable<T>, thus, you can group, sort, and perform other sequential data manipulations in template expressions in a common way.
Extension Method | Example |
All(Predicate) |
persons.All(p => p.Age < 50) |
Any() |
Persons.Any() |
Any(Predicate) |
persons.Any(p => p.Name == "John Smith") |
Average(Selector) |
persons.Average(p => p.Age) |
Concat(IEnumerable) |
persons.Concat(otherPersons) |
Contains(Object) |
persons.Contains(otherPersons.First()) |
Count() |
persons.Count() |
Count(Predicate) |
persons.Count(p => p.Age > 30) |
Distinct() |
persons.Distinct() |
First() |
persons.First() |
First(Predicate) |
persons.First(p => p.Age > 30) |
FirstOrDefault() |
persons.FirstOrDefault() |
FirstOrDefault(Predicate) |
persons.FirstOrDefault(p => p.Age > 30) |
GroupBy(Selector) |
persons.GroupBy(p => p.Age) or persons.GroupBy( p => new { Age = p.Age, Count = p.Children.Count() }) |
Last() |
persons.Last() |
Last(Predicate) |
persons.Last(p => p.Age > 100) |
LastOrDefault() |
persons.LastOrDefault() |
LastOrDefault(Predicate) |
persons.LastOrDefault(p => p.Age > 100) |
Max(ComparableSelector) |
persons.Max(p => p.Age) |
Min(ComparableSelector) |
persons.Min(p => p.Age) |
OrderBy(ComparableSelector) |
persons.OrderBy(p => p.Age) Or persons.OrderBy(p => p.Age).ThenByDescending(p => p.Name) |
OrderByDescending(ComparableSelector) |
persons.OrderByDescending(p => p.Age) Or persons.OrderByDescending(p => p.Age).ThenByDescending(p => p.Name) |
Select(Selector) |
persons.Select(p => p.Name) |
SelectMany(EnumerationSelector) |
persons.SelectMany(p => p.Children) |
Single() |
persons.Single() |
Single(Predicate) |
persons.Single(p => p.Name == "John Smith") |
SingleOrDefault() |
persons.SingleOrDefault() |
SingleOrDefault(Predicate) |
persons.SingleOrDefault(p => p.Name == "John Smith") |
Skip(int) |
persons.Skip(10) |
SkipWhile(Predicate) |
persons.SkipWhile(p => p.Age < 21) |
Sum(Selector) |
persons.Sum(p => p.Children.Count()) |
Take(int) |
persons.Take(5) |
TakeWhile(Predicate) |
persons.TakeWhile(p => p.Age < 50) |
Union(IEnumerable) |
persons.Union(otherPersons) |
Where(Predicate) |
persons.Where(p => p.Age > 18) |
0 Comments