Changes

Jump to navigation Jump to search
2 bytes added ,  17:55, 2 February 2020
Line 47: Line 47:  
* Clamp01(x) – Clamps x between 0 and 1
 
* Clamp01(x) – Clamps x between 0 and 1
 
===Enumerable functions===
 
===Enumerable functions===
These functions can be used on any C# enumerable, e.g. arrays, lists, dictionaries, sets, etc. You simply use the function on the enumerable, and pass an anonymous function as a parameter, using x to refer to the elements of the enumerable, e.g. employees.Where(x.Salary > 1000).OrderBy(x.Age).Select(x.Name), will return the names of all employees that make more than $1000 ordered by their age. They work exactly like LINQ extension methods, basically.
+
These functions can be used on any C# enumerable, e.g. arrays, lists, dictionaries, sets, etc. You simply use the function on the enumerable, and pass an anonymous function as a parameter, using x to refer to the elements of the enumerable, e.g.
 +
employees.Where(x.Salary > 1000).OrderBy(x.Age).Select(x.Name) //Will return the names of all employees that make more than $1000 ordered by their age.
 +
They work exactly like LINQ extension methods, basically.
    
* Any(func) – Returns whether any elements satisfy func(x)
 
* Any(func) – Returns whether any elements satisfy func(x)

Navigation menu