C # knowledge to consolidate a

Console program, several signature Main function

1 public static void Main() { }
2 public static int Main() { }
3 public static void Main(string[] args) { }
4 public static int Main(string[] args) { }
5 public static async Task Main() { }
6 public static async Task<int> Main() { }
7 public static async Task Main(string[] args) { }
8 public static async Task<int> Main(string[] args) { }
View Code

What type of function

  • Methods (Method)
  • Properties (property)
  • Events (Event)
  • Indexers (index)
  • User-defined operators (custom operator)
  • Instance constructors (instance constructors)
  • Static constructors (static constructor)
  • Destructors (destructor)

 Identifiers, definitions and relationships keywords

 It is applied to the variable identifier, class, method, and various other general terms user-defined objects. You shall observe the following rules when naming identifiers:

  • Identifiers can not begin with a number and can not contain spaces.
  • Identifiers can contain uppercase and lowercase letters, numbers, underscores and @ characters.
  • The identifier must be case-sensitive. Uppercase and lowercase letters are considered different letters.
  • @ Character is only the first character identifier. An identifier with an @ prefix is ​​called a verbatim identifier.
  • You can not use C # keywords. However, the @ character add keywords can be a legal identifier, it is not recommended.
  • Not the same as the library name to C #

 Keyword (for viewing only, no memory)


 

 Contextual keyword (for viewing only, no memory)

 

 Reference links:

Microsoft's official documentation Main function

Microsoft's official documentation Function Members

C # identifiers and keywords

 Microsoft's official documentation C # key

 

 

Guess you like

Origin www.cnblogs.com/wu-xin/p/12006823.html
Recommended