Foreach in. c # is of the type
Foreach (int I in arr)
{
}
2. The goto statement is allowed in c #.
The usage is a goto identifier. The identifier must contain the following letters:
3. c # allows small-scale jumps, but does not allow jump across functions or methods
4. The goto statement can also be used in the switch.
5. throw is a type of throw statement.
6. The final result transmitted by reference may change the value of the passed parameter. The value is passed without changing the value.
7. The out keyword is generally used to make a method have multiple return values.
8. In a project, declared global variables can be included in the namespace. The so-called global variables in a class
It must be modified with the static keyword.
9. Common Methods
9.1 variable to string method variable. ToString ()
9.2 convert to 32-digit font. Int32Parse (variable) or Int32 ("constant ")
9.3 string addition System. Text. StringBuilder ("")
9.4 string truncation variable. Substring)
9.5 get the string Length variable. Length
9.6 check whether the specified position is an empty string char. IsWhiteSpace (string, number of digits)
9.7 check whether the string is a punctuation character char. IsPunctuation ('string ')
9.8 convert the character into a number and check the Code Point (int) 'char'
9.9 numeric to character (char) Code
9.10 clear spaces before and after characters Trim ()
9.11 string replacement string. Replace ("string", "Replace ")
9.12 find the position where the character appears in the string and return the index value IndexOf ()
9.13 LastIndexOf ()
9.14 Insert (,) at the specified index (,)
9.15 plus characters or spaces PadRight (,) PadLeft (,)
9.16 Delete the specified string from the specified position Remove ()
9.17 get the current year month day hour minute second System. DateTime. Now
9.18 get the current Year variable. Year Month Day Hour Minute Second Millisecond
9.19 obtain the maximum Math. Max)
9.20 convert to bitcode System. Text. Encoding. Default. GetBytes (variable)
9.21 obtain the remote user IP address Request. ServerVariables ["REMOTE_ADDR"]
9.22 obtain the real IP address and pass through the proxy Request. ServerVariables ["HTTP_X_FORWARDED_FOR"]
9.23 Session ["variable"] Session ["variable"]
9.24 use a hyperlink to pass the variable String str = Request. QueryString ["variable"]
9.25 create XML document new node CreateElement ("new node name ")
9.26 Add the new child node to the parent node. AppendChild (child node) under the XML document parent node)
9.27 Delete the parent node of a node. RemoveChild (node)
9.28 jump to the URL specified page Response. Redirect ("URL address ")
9.29 output string Response. Write ("string ")
9.30 output variable Response. Write (variable name)