I. Simple anonymous method
1.0 rules for how anonymous methods are written:
delegate (the parameters, format and type of the anonymous method are defined by the programmer himself according to the business logic) {Function's method body code}
At the bottom, write the anonymous method parameter written using Deledate
Two. Small practice examples and LANBDA expression inference
Small summary: 1. If there is only one argument, you can omit the parentheses, leaving only the parameter name, and if the number of arguments is greater than one, you must
Keep parentheses for example (pig,dog=>true)
2. You can omit {} and the last semicolon when there is only one aunt in the method body, and if there is a return value you can omit return
3. When the method body has multiple lines of code can not omit {}, if there is a return value can not omit the return
1
Three. Extension methods
1.0 features of the extension method
1. This method must be dead static class
2. This method must be in a static class
3. The first parameter of this method must begin with this, and the specified method is the extension on which type
MVC new Syntax anonymous method