I. Objects and Types
- Structs and classes differ in how they are stored, how they are accessed (the type of reference that the class stores on the heap), and the structure is the value type stored on the stack (stack).
- PS: Distinguish between reference types and value types, please recall (two kids with Lollipop on hand) and (two kids grab remote control to watch TV) example
- The ref parameter forces the variable to participate in the method by means of a reference pass, and of course the REF keyword is added when calling the method
- The Out keyword allows a function to have multiple returns
- Some small limitations of the C # method Overload:
- Two methods cannot be distinguished only on return types
- Two methods cannot be distinguished only by parameter declaration as ref or out
- You can set different access modifiers for the get and set methods of a property
- The same constructor can also set different access modifiers
- Static constructors, which are executed only once, note that static constructors cannot have access modifiers, and of course a class can have only one static constructor, and static constructors can only access static members
Essay C # Advanced Programming (Seventh edition)