Differences between value types and reference types (based on C #) 1. Type Distribution C # The value types include the following types: simple type, structure type (struct), and enumeration type (enum ). Simple types include: INTEGER (int), Boolean (bool), character (char), and real (double, decimal). Needless to say about the structure and enumeration, the structure is the sub-assembly used to store small variable groups. You can understand enumeration. The reference type in C # contains the following types: Class, interface, array, and delegate, which all belong to the reference type. 2. the C # value type is stored as a value, and the value type is usually allocated to the stack. In C #, instances of the reference type are allocated to the stack. Create a new instance of the reference type. The variable value corresponds to the memory allocation address of the instance, just like your bank account. 3. demousing System; using System. collections. generic; using System. text; namespace ConsoleApplication1 {class Person {public int Blood = 10;} class Program {public static void Add (int x) {x ++ = 10; Console. writeLine ("value type after the parameter is passed and modified:" + x);} public static void Add (Person person) {person. blood + = 10; Console. writeLine ("reference type after the parameter is passed and modified:" + person. blood);} static void Main (string [] args) {// Value Type Variable int I = 10; Console. writeLine ("I Original Value:" + I); Add (I); Console. writeLine ("but the I value is not modified because of Function Modification:" + I); // reference type variable Person person = new Person (); Console. writeLine ("original Blood value:" + person. blood); Add (person); www.2cto.com Console. writeLine ("but the value of Blood is modified because of the Function Modification:" + person. blood); // The difference between the value type and the reference type is that when function parameters are passed. // The value type is to copy and pass your own values to other function operations. no matter how the copied value is changed. its own value will not change // and the reference type is to pass its memory address to other function operations. the operation is the reference type value itself. so the value is changed by the function. // This is the difference between data transfer and data transfer. Console. readLine ();}}}