
Understanding Key Advantages of .NET Type SystemWhile programming in most of the languages there is need to define the type of a value. Type is basically is a representation mechanism or method of representing values. In .NET too while defining a class or an integer we are actually defining a type. .NET type
system or CLR type system consists of value types and reference types.
Value types represent a value in the form of sequence of bits in the memory.
These are also divided into two sets: built-in value types like integers,
strings and user defined value types like structures and classes.
Reference
types do not store the actual values but they contain the address of the
other memory location where the actual value or data is stored. There
are three categories of reference types: object types, interface types
and pointer types in .NET. Object types represent classes. String is also
a built-in object type. Interface
type represents a method, property or an event. Pointer types supported
by .NET are unmanaged function pointers which refer to code, managed pointers
which refer to garbage collector and unmanaged pointers which refer to
values. Now lets
discuss the advantages of .NET type system. First of all in .NET you are
allowed to define as well as share the types. This is not restricted to
a single language only but you can share the defined type in other languages
too with a high level of interoperability. So .NET type
system supports different programming languages. Also security on types
is also considered in the CLR. Another beneficial feature of type system
in .NET is visibility. Types which are exported from their assemblies
are visible outside too to other types. Also in .NET
types are allowed to choose from a wide range of accessibility levels.
Accessibility level specifies which other types can access the members
of a given type. Different categories of accessibility levels defined
in .NET are explained below. First is
public which means that the type is available for all other types and
can be accessed by them. Secondly,
the assembly which specifies that type can be accessed by those types
which reside in the same assembly. Third, there
is family which means that the type is available to all the subtypes.
Fourth category
is of compiler controlled accessibility level which means that types can
be accessed in one translation unit only. Finally there
is private category which is quite clear from its name. It is available
only inside its definition. So accessibility levels provided by CLR in
.NET type system are beneficial to the developer in order to choose his/her
level according to the requirement.
_______________________________________________________________________
FREE
Subscription
Subscribe
to our mailing list and receive new articles Note
: We never rent, trade, or sell my email lists to Visit
.NET Programming Tutorial Homepage ______________________________________________________ |