How does a C # class perform?
public class person{
static person () {}//Do not write, default also has an empty
Public person () {}//not written, default also has an empty
public string name{get;private Set;}//property, only open Write permission for this class
}
So a man appeared, and there were two methods of construction
The first is the constructor of the class, the second is the instance construction method, the first one is exposed only to this class, it is the method that the static members of this class can access, and the second is the class is executed when new is instantiated.
The execution order is static first, and then the other construction methods
Person Person=new person ();
Person. Name= "Zzl"; This statement is wrong, because the name property of the person object has only write access to itself
How does a C # class perform?