Enumeration in Templates

Using PDF4me you can manipulate data collection(iterable). The methods provide control over data like the IEnumerable in C# which provides various sorting and data manipulations while generating templates.

Let us look at the list of methods that can be used for controlling data -

All(Predicate)
employees.All(p => p.Age < 50)
Any()
employees.Any()
Any(Predicate)
employees.Any(p => p.Name == "Mary Doe")
Average(Selector)
employees.Average(p => p.Age)
Concat(IEnumerable)
employees.Concat(otherPersons)
Contains(Object)
employees.Contains(otherPersons.First())
Count()
employees.Count()
Count(Predicate)
emloyees.Count(p => p.Age > 30)
Distinct()
employees.Distinct()
First()
employees.First()
First(Predicate)
employees.First(p => p.Age > 30)
FirstOrDefault()
employees.FirstOrDefault()
FirstOrDefault(Predicate)
persons.FirstOrDefault(p => p.Age > 30)
GroupBy(Selector)
employees.GroupBy(p => p.Age

or

employees.GroupBy( p => new { Age = p.Age, Count = p.Children.Count() })
Last()
employees.Last()
Last(Predicate)
employees.Last(p => p.Age > 100)
LastOrDefault()
employees.LastOrDefault()
LastOrDefault(Predicate)
employees.LastOrDefault(p => p.Age > 100)
Max(ComparableSelector)
persons.Max(p => p.Age)
Min(ComparableSelector)
employees.Min(p => p.Age)
OrderBy(ComparableSelector)
employees.OrderBy(p => p.Age)

or

employees.OrderBy(p => p.Age).ThenByDescending(p => p.Name)
OrderByDescending(ComparableSelector)
employees.OrderByDescending(p => p.Age)

or

employees.OrderByDescending(p => p.Age).ThenByDescending(p => p.Name)
Select(Selector)
employees.Select(p => p.Name)
SelectMany(EnumerationSelector)
employees.SelectMany(p => p.Children)
Single()
employees.Single()
Single(Predicate)
employees.Single(p => p.Name == "John Smith")
SingleOrDefault()
employees.SingleOrDefault()
SingleOrDefault(Predicate)
employees.SingleOrDefault(p => p.Name == "Mary Doe")
Skip(int)
employees.Skip(10)
SkipWhile(Predicate)
employees.SkipWhile(p => p.Age < 35)
Sum(Selector)
employees.Sum(p => p.Children.Count())
Take(int)
employees.Take(5)
TakeWhile(Predicate)
employees.TakeWhile(p => p.Age < 50)
Union(IEnumerable)
employees.Union(otherPersons)
Where(Predicate)
employees.Where(p => p.Age > 18)