This is my first blog, I have learned some of the summed up, if there is a mistake, please contact me to change
1, naming conventions
field, the local variable is named by Camal, which is the first letter lowercase, the other uppercase.
The type, method, and attribute are named by Pascal.
2, annotation method
Line Comment://
Documentation Notes://
Block Comment:/* */
3, pre-defined type
Simple Type: 11 Types of Numbers (sbyte,byte,short,ushort,int,uint,long,ulong,double,decimal,float), Char,bool
Non-Simple type: string,object,decimal
4, user-defined type
Class,delegate,interface,enum,struct,array
5, value type and reference type
Value type: struct,enum, all numeric types
Reference type: Class,delegate,interface,array
6, access modifier
Private (accessible only from within the class)
Internal (default, can only be accessed centrally in the assembly)
Protected (only subclass access)
Internal protected (accessible from assemblies and subclasses)
Public (can be accessed anywhere)
7, class member
Field: Used to store data, can be any type, can be automatically initialized to the default value
Properties: Readable properties, writable properties, automatic properties, readable writable properties
Method: Parameter type, ref out params
8, keyword
This: calling the class member; displaying the call constructor
Base: Call base class member, call base class constructor
9, type conversion
Implicit conversions: Low-level numeric types become high-bit numeric types, int to long, classes or interfaces can be converted to object, implemented interfaces, classes;
Display conversion: Convert method, () target (the conversion failure throws an exception); as operator (conversion failure does not throw an exception, return null); You can use checked (failure throws an exception), unchecked statement checks for overflow
Boxing: Value type to reference type
Unpacking: Reference type to value type (loaded, unpacking can consume performance and should be avoided)
10, Delegate
System Delegate,action<> no return value
Func<> has a return value
11, Exception
With a try catch or try Catch finally or try finally
A try can have only a finally, can have multiple catch anyway, finally will be executed
Catch if there is no catch for the exception, the stack is expanded to look for a matching catch, none throws an exception
C # Basics Summary