Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Difference between CTS and CLS S.

No 1 CTS Abbreviation: CLS Abbreviation:

CTS stands for Common Type CLS stands for Common Language System Specification 2 Meaning: It describes how types are declared, used and managed in the runtime and facilitates crosslanguage integration, type safety, and high performance code execution. Meaning:

It is a specification that defines the rules to support language integration in such a way that programs written in any language, yet can interoperate with one another, taking full advantage of inheritance, polymorphism, exceptions, and other features. These The types defined by the CTS are rules and the specification are broadly classified into value types documented in the ECMA proposed and reference types. Value types standard document. are those which themselves contain data/methods/resources represented by the type - like an integer variable is a value type. Reference types are those which refer to value types and a pointer or a reference is an example of such a type. All types derive from 'System.Object' base type. 3 Power of CTS: Power of CLS:

CTS is a superset of the CLS is a subset of the CTS which CLS,i.e.,all .NET languages will all .NET languages are expected to not support all the types in the support. CTS. 4 Example: Integer datatype in VB and int datatype in C++ are not compatible, so the interfacing between them is very complicated. In order that two different languages can communicate, Integer in VB6 and int in C++ will convert to System.int32 which is datatype of CTS. (or) Example: A class written in C# can inherit from a class written in VB. So we can say that using this specification (CLSCompliant attribute) in our programs (written in any language), the type is forced to conform to the rules of CLS and programs can interoperate with one another, taking full advantage of polymorphism, inheritance and other features.

In c#, we will declare int i; In vb, we will declare dim i as integer Basically Microsoft will convert all this data types to the generic data types. So, if we write code in different languages that will convert into language independent code. This is called Common type system(CTS).

And, further updates on difference between questions and answers, please visit my blog @ http://onlydifferencefaqs.blogspot.in/

You might also like