Wednesday, November 2, 2011

What is CLR, CTS, CLS in .NET?

Common Language Runtime (CLR)
One of the most important component of .NET framework is CLR, also known as runtime. It provides functionalities like
  1. Memory Management
  2. Exception handling
  3. Debugging
  4. Code Access Security (CAS)
  5. Thread Execution
  6. Compilation
The runtime manages the execution of code. It also enables you to develop application in the language of your choice, such as C#, Visual Basic and Visual C++. You can also refer the class library and other components that are written in different languages supported by .NET framework.
Common Type System (CTS)
The CTS specifies certain guidelines for declaring, using, and managing types at runtime. The functions performed by the CTS are as follows:
  1. Cross-language communication, type safety, and high performance execution of code.
  2. Object-oriented model for implementation of different programming languages.
  3. Guidelines for different languages to follow, ensuring proper interaction between objects implemented in different programming languages.
The CTS can be classified as Value and Reference types.
Common Language Specification (CLS)
The CLS consists of a set of basic language features that are required by many applications to communicate with other objects, irrespective of the language in which they are implemented. The CLS rules define a subset of the common type system. These objects must expose only those features that are common to all the languages they need to interact with. The components which adhere to these features are said to be CLS compliant components. In simple words it facilitates cross-language interoperability.



CLR - CTS - CLS
The .NET Framework provides a runtime environment called the Common Language Runtime or CLR (similar to the Java Virtual Machine or JVM in Java), which handles the execution of code and provides useful services for the implementation of the program.
The Common Language Runtime is the underpinning of the .NET Framework. CLR takes care of code management at program execution and provides various beneficial services such as memory management, thread management, security management, code verification, compilation, and other system services. The managed code that targets CLR benefits from useful features such as cross-language integration, cross-language exception handling, versioning, enhanced security, deployment support, and debugging.
Common Type System (CTS) describes how types are declared, used and managed in the runtime and facilitates cross-language integration, type safety, and high performance code execution.
The Common Language Specification (CLS) is an agreement among language designers and class library designers to use a common subset of basic language features that all languages have to follow.

No comments:

Post a Comment