Saturday, May 26, 2012

Value and Reference types

All the types are derived from System.Object base type.

Value type - contain actual value on its memory location. Its allocated to stack.
Reference type - contains a new memory location address on its memory location. Its allocated to heap.
Changing value of a reference type can effect some other objects those are referring that reference type.

Value types ex. - All numeric types, Datetime, Boolean, Char, Structure, Enumeration.
Reference types ex. - String, Array, Delegate, Class.

* Structure and Enumeration are value types even they contain reference type members.
* String, Array are reference types even they contain value types.

No comments:

Post a Comment

CI/CD - Safe DB Changes/Migrations

Safe DB Migrations means updating your database schema without breaking the running application and without downtime . In real systems (A...