Signum Documentation

The documentation comes from the Markdown files in the source code, so is always up-to-date but available only in English. Enjoy!

Paste your Framework commit SHA

LambdaComparer

In many .Net and SF API a IComparer or IEqualityComparer is taken as a parameter of the constructor of a data structure or a method.

Implementing a IComparer is too ceremonial, lambda comparer makes it simpler.

public class LambdaComparer<T, S> : IComparer<T>, IEqualityComparer<T>, IComparer, IEqualityComparer
{
   public LambdaComparer(Func<T, S> func){..}
   
   (...)
}

Example:

List<Person> people = (...);
people.Sort(new LambdaComparer<Person, string>(p=>p.Name));