What do you understand by value types and reference types in C#.NET?

In C#, there are two types of data. One is called value type and another is called reference type. Value types are types that hold the value directly in the memory location. If the value is copied, a new memory location holds the same value, and both are independent of each other. A reference type is when the value is not directly placed in the memory location but a reference to the value is set instead. Another major difference between value types and reference types is that value types are located in stacks and reference types are located in heaps. An example of a value type is int, whereas an example of a reference type is string.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.136.25.35