ASP.NET Common Type System

Because the runtime, rather than an individual language compiler, defines the available base types, developer productivity is enhanced. Programmers can write applications in their development language of choice, yet take full advantage of the runtime, the class library, and components written in other languages by other developers. Provided that a language compiler targets the .NET Framework and the common language runtime, components developed with that compiler can usually be accessed from applications developed in other languages. The common type system helps to realize the goal of language independence; developers can focus on developing an application in their language of choice, and can draw on libraries and components regardless of the language in which they were written.

The common type system supports two general categories of data types:

Value types
Value types directly contain their data, and instances of value types are either allocated on the stack or allocated inline in a structure. Value types can be built-in (implemented by the runtime), user-defined, or enumerations.

Reference types
Reference types store a reference to the value's memory address and are allocated on the heap. Reference types can be self-describing types, pointer types, or interface types. The type of a reference type can be determined from values of self-describing types. Self-describing types are further split into arrays and class types. The class types are user-defined classes, boxed value types, and delegates.

Variables that are value types each have their own copy of the data; therefore, operations on one variable do not affect other variables. Variables that are reference types can refer to the same object; therefore, operations on one variable can affect the same object referred to by another variable.

No comments: