inline variables
When using Int.tryparst, declare the variable first for the out parameter
int D;
Int.tryparse (S,out D);
The use of inline variable notation can be as follows. Functionality simplifies writing
Int.tryparse (s,out int d)
$ "{Val1}-{val2}"
Functions like String.Format ("{0}-{1}", Val1,val2), which is parsed as a variable within {} in the string that begins with $.
Method of writing in the method
You can write some methods inside the method. js-like this write a function in the function
function ShowMsg (msg)
{
function validate () {}
}
/*
For example, the processing of a numeric string sort, if it is only a temporary use, you can not add a method, directly in the method to write a processing method on the line.
*/
Sort a number into a string
private string OrderList (String strnum)
{
}
Given string, returns the sorted result
public string Orderstringnum (String Str,int ordertype)
{
return this.orderlist (str);
}
Write directly within the method
Given string, returns the sorted result
public string Orderstringnum (String Str,int ordertype)
{
String OrderList (String strnum)
{
}
return orderlist (str);
}
Note: The method cannot be preceded by the private public, and it can only be used inside a declarative method. Similar to lambda, but it is essentially a method, and it is not as awkward to write as lambda.
C # New Syntax collection