Understanding Key Advantages of .NET Type System

While 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 let’s 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.

| About Runtime Components of .NET Framework | About Session Management in a Web Based Enterprise Application | An introduction to Microsoft Mobile Internet Toolkit (MMIT) | How to Internationalize Your .NET Application | How to Create a Document Type Definition (DTD) | How to Create a .NET Windows Service Easily | Knowing the Difference Between Application Server and Web Server | Understanding Key Advantages of .NET Type System | Understanding Some Basic Language Related Features of C# |


“Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.”

| Privacy Policy for www.dotnet-guide.com | Disclosure | Contact |

Copyright - © 2004 - 2024 - All Rights Reserved.