=> The struct primitive is also a Lambda operator. It is used in lambda expressions to split the lambda main body on the right and the number of changes on the left. Lambda's formula is an inline formula of an anonymous method. It will be used in a large amount in the LINQ lookup representation in the method scheme method.
string[] words = { "cherry", "apple", "blueberry" };int shortestWordLength = words.Min(w => w.Length);Console.WriteLine(shortestWordLength);
=> The operation operator is "goes ". In the previous example, the formula is as follows: "minimum W steps] To W points length 」.
=> The operation operator and the assignment operator (=) have the same sort first in descending order and are right-aligned.
You can explicitly specify the type of the incoming variable, or let the compiler promote the type of the variable. In these cases, the data changes to strongrong typed during the peak period ). When you set the parameter, you must enclose the parameter name and variable name in Arc mode, as shown in the following example:
int shortestWordLength = words.Min((string w) => w.Length);
Multiple changes can be included in the arc, as shown in the following example.
Example
The following example illustrates how to create a Lambda formula with two variable numbers for the parameter query operator enumerable. Where. This formula returns all strings with a length smaller than the index position in the lower column.
Vbc # C ++ F # JScript
string[] digits = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" };var shortDigits = digits.Where((digit, index) => digit.Length < index);foreach (var sD in shortDigits){ Console.WriteLine(sD);}// Output:// five// six// seven// eight// nine