The .NET Framework is a development platform for application which provides services like building, deploying, and running applications of desktop, web, and phone and web services. It can be called as Development platform or Execution environment which consists of tools and technologies, to develop distributed applications and distributed web services.
The .Net Framework mainly consists of two major components that are common language runtime (CLR), which provides memory management and other services, and an extensive class library, which includes tested, reusable code for all major areas of application development.
- It gives an object oriented programming environment whether the object code is stored and executed locally or executed locally.
- It minimizes the software deployment and versioning conflicts.
- It promotes safe execution of code, even code created by any unknown.
- It eliminates the performance problems of scripted environments.
- It helps the developer for developing various types of applications, such as Windows-based applications and Web-based applications.
Features of .Net Framework:
- Memory Management – In many other programming languages the responsibility of developers is to allocate and reallocate the memory but in .Net Framework CLR is responsible for all these.
- Common Type System – In other programming languages, the basic types are defined by the compiler only, where interoperability is not possible whereas in the .NET Framework, the basic types are defined by the .NET Framework type system which are common to all languages which are the part of the .NET Framework.
- Extensive class library – The programmers can use the readily accessible library of various data types and members from the .NET Framework Class Library instead of writing the vast amount of codes.
- Version compatibility – Applications which have been developed by using a particular version of the .NET Framework can run without modification on a later version.
Common Language Infrastructure
The Common Language Infrastructure (CLI) is developed by Microsoft and is standardized by ISO and ECMA which helps in running high level language application programs in different computer systems. The CLI allows multiple high-level languages to be used on different platforms without being writing again for the application. The CLI has four aspects which are as follows:-
- CTS (Common Type System) - The set of data types and operations which are shared by all the CTS-compliant programming languages.
- Meta data - It describes all those classes and class members which are defined in the assembly, and those classes and class members which are in the current assembly and will be called from the another assembly.
- CLS (Common Language specification) - The set of basic rules for any language which is targeting the CLI should conform to interoperate with other CLS-compliant languages.
- VES (Virtual Execution System) - The VES will load and execute CLI-compatible programs using the metadata to combine with the separated executed pieces of code at runtime.
Common Type System (CTS)
It describes the set of types which can be used in different .Net languages as common. It ensures that the objects which are written in different .Net languages can communicate with each other. But for the communication between programs that are written in any .NET complaint language, the types would have to be compatible on the basic level.
It supports the object oriented concepts that is why all the types are represented in this as objects and also provides support of sharing of common data types. CTS support two different types: Value and Reference type.
- Value type: The primitive or built in data types of the programming language are known as Value type. It also includes user defined types and enumerations. They are used to store the value of the variable which includes String, Character, Integer, etc. These data types are passed in the method by using by value method.
- Reference Types: In the reference types they store a reference to the value's memory address, and are allocated on the heap. They can be self-describing types, pointer types, or interface types. Reference types are those whose data type objects are represented by a reference to the object's actual value.
Common Language Specification (CLS)
The Common Language Specification (CLS) is the set of some basic language features where .Net languages can develop the applications and services, which are compatible with the .Net Framework. If the situation arises of communicating objects which are written in different .Net Complaint languages, then those objects must expose the features that are common to all the languages.
Common Language Specification (CLS) provides the feature of complete interoperability among applications, which is regardless of the language used to create the application.
Common Language Specification (CLS) defines the subset of Common Type System (CTS) and the Common Type System (CTS) describes the set of types that can use different .Net languages are common, it ensure that objects written in different languages can communicate with each other.
Common Language Runtime (CLR)
The Common Language Runtime is the first main component of .Net Framework. The Common Language Runtime main features are to manage memory, thread execution, code execution, code safety verification and other services. CLR is an execution environment for the program code which is defined by CLI. Basically, CLR lies between operating systems and applications which are written in .Net languages. Some of the features of CLR are:
- Automatic Memory Management – The CLR provides the garbage collection where the lifetime of the objects is managed by garbage collection only and it is known as managed data.
- Platform Independence – We can build program in any language which targets the CLR, while compiling the program the compiler translates the code into an intermediate language which is CPU independent. It can be executed from any platform which supports the .Net CLR.
- Security management – It can be achieved through code access Security model. In this, model CLR implements restrictions on managed code with the use of objects called permissions. It specifies what the code can access instead of specifying who can access the resources.
- Language interoperability – The ability of an application to communicate with another application written in a different programming language. It helps in the reusability of code.
Common Language Runtime Architecture
- Class Loader: In this component the compiler of the .Net Framework compiles the source code into intermediate code and it consists of MSIL code and Metadata and they are contained in a portable executable (PE) file.
- Code Manager: This component manages the code during execution time. It is the responsibility of the code manager to allocate memory to the objects.
- Garbage collector: This component provides the automatic garbage collection of the object when the object is no longer in use.
- Security Checker: It is the most important component of CLR. The responsibility is to restrict the access to system resources such as hard disk.
- Type Checker: This component provides the facility of data type checking of the variable. It also checks the valid operations on the corresponding data type.
Framework Class Library
The .Net Framework class library is the collection of reusable types which can be integrated with the Common Language Runtime. The class library is the object oriented. The other main component of the .Net Framework is Framework Class Library which is a standard library. It is the collection of thousands of reusable classes, interfaces and value types.