C # basic value type and reference type,
Value Type: int double char bool decimal struct enum value stored on the memory Stack
Reference Type: string Array, custom class interface, delegated value stored in heap
Value Transfer: Pass the value type as a parameter, and pass the value itself ---- Note: ref can change the value transfer to reference.
Reference transfer: Pass the value of the reference type as a parameter, and pass the reference
Static void Main (string [] args) {int number = 10; Test (number); Console. writeLine (number); Console. readKey () ;}static void Test (int n) {n + = 10;} pass the num value to n, and the cmd result is 10; static void Main (string [] args) {int number = 10; Test (ref number); Console. writeLine (number); Console. readKey () ;}static void Test (ref int n) {n + = 10;} transmits the num address to n. In this case, num and n point to an address, and the cmd result is 20;