NET Framework Common Language” The classes in .NET Framework Class library are organized into directory like structures called namespaces. A namespace is a logical group of the classes of similar types.
For example: System. Windows. Forms namespace contains the classes related for building desktop applications for Windows. A namespace helps to organize the classes so they can be accessed easily. All classes in a namespace can be accessed by importing the namespace into an application.
NET Framework Common Language It Series
All the applications developed by using the .NET Framework are also made up of assemblies. An assembly is a single deplorable unit that contains all the information about the implementation of classes, structures and interfaces.
The metadata of the assembly stores information about the assembly. This information includes the name and version number of the assembly, security information and a list of the files that make the assembly.
Assemblies and metadata provide the required information to the CLR to execute an application. If an application uses a component, the assembly keeps track of the version number of the component.
The assembly provides this information to the CLR while the application is being executed.
Common Language Run time (CLR)
The Common Language Runtime (CLR) is the foundation of the .NET Framework. It provides the services that are needed to execute any application developed with one of the NET languages.
It manages the execution of programs and hides from them the underlying operating system and hardware. The .NET applications are managed by CLR and are sometimes called managed applications.
The source code of these applications are known as managed code and is executed directly by the CLR instead of the operating system. CLR also provides various services to execute processes such as memory management, error handling and security services.
It performs various tasks to manage the execution of .NET applications. Some important responsibilities of CLR are as follows:
1. Automatic Memory Management:-
The CLR provides the garbage collection feature to manage the lifetime of an object. It automatically deallocates the blocks of memory associated with the objects that are no longer used.
The objects whose lifetime is managed by the garbage collection process are called managed data.
2. Common Type System:-
The Common Type System (CTS) provides a type system that is common across all .NET languages. It means that all .NET programming languages use the same representation for common data types.
For example: The size of an integer or a long variable is the same in all .NET languages. It also defines the rules to ensure that the objects written in different languages can interact with each other.
3. Language Interoperability:-
Language interoperability is the ability of an application to communicate with another application written in a different programming language. It helps to maximize code reuse.
For example: A class written in Visual Basic can be inherited in a code written in Visual C++.
It also helps to improve the efficiency of the development process. The CLR provides support for language interoperability by specifying and enforcing a CTS and by providing metadata.
4. Platform Independence:-
A program developed in a language that targets the CLR is translated by the compiler into an intermediate language. This language is CPU-independent. It means that the code can be executed on any platform that supports the .NET CLR.
5. Security Management:-
The security model of traditional operating system provides permissions to access resources such as memory and data based on user accounts.
The .NET platform implements security through the Code Access Security (CAS). model. In this model, the CLR enforces restrictions on managed code by allowing the code to perform only those tasks for which it has permissions.
It specifies what resources the code can access instead of specifying who can access resources.
6. Type Safety:-
The type safety feature ensures that objects are always accessed in compatible ways.
For example: CLR will not allow the code to assign a 10-bytes value to an object that occupies 8-bytes in memory.