Codechef4u is a community for computer professionals,by computer professionals,just like you; who loves sharing and helping each others,Join them
Share your post

CLS in .Net

What is the CLS?

CLS is nothing but set of guideless provided by Microsoft that language to follow so that it can communicate with other .NET languages in a seamless manner. It was always a dream of Microsoft to unite all different languages in to one umbrella and CLS is one-step towards that.

CLS stands for common language specification.

CLS rules helps to enhance and ensure language interoperability

 

Better understanding with Example:

CTS are base library which contains all type information like int32, int64, Boolean etc.

For example CLR understands only type int32 type, CLS guidelines maps two different languages types(C# int and VB integer) into int32.

For example common helper class for database application written in C# and database application written in VB and declared following variable.

VB declaration:

Dim roleId As Integer

Same variable now you can declare in C# helper class.

C# declaration:

public int roleId;

 Compiler reads the associated base type of int(C# Integer in VB) is Int32 from CLS guidelines and convert it to Int32.

 

 

CTS in .NET

What is the CTS?

Common type system check how types are declared ,used and managed in common language run time.

CTS standardize types for cross-language integration.


CTS stands for Common type system

 

The CTS performs following functions:

1. Enable cross-language integration, type safety, and high-performance code execution.
2. Provide OOPs model for multiple language implementation.
3. Defines rules that all languages follow it, which helps ensure that objects written in different Languages can interact with each other.
4. provides a library that contains the primitive data types (such as Boolean, Byte, Char, Int32, and UInt64) used in application development.

 

This is the range of types that the .NET run time understands, and therefore that .NET applications can use.. The CTS is a super set of the CLS(Common language specification).

Example:

Declaration of int variable in VB converted into int32 in C#, System.int class ensures that type safety.



CLR in .Net

What is the CLR?

CLR is runtime environment provided by Microsoft with .net framework to make development process easier.

Code we develop with CLR is called managed code


CLR stand for  Common Language Runtime.


CLR is set of resources provided by Microsoft:

 

1.  Security model
2. Type system
3. All .NET base classes
4. Many .NET framework classes
5. Development, debugging, and profiling tools
6.  Execution and code management
7.  IL-to-native translators and optimizers


Advantages using CLR:

1.  Performance improvements.
2.  Cross-language exception handling
3.  Cross-language integration
4.  Enhanced security
5.  Versioning and deployment support
6.  Debugging and profiling services
7.  Support for custom attributes
8.  A simplified model for component interaction
9.  Garbage Collection
10.  Use of delegates instead increases type safety and security instead of function pointers.
11.  Language features such as inheritance, interfaces, and overloading for object-oriented programming