1. Difference between CTS and CLS
S.No CTS CLS
1 Abbreviation: Abbreviation:
CTS stands for Common Type CLS stands for Common Language
System Specification
2 Meaning: Meaning:
It describes how types are It is a specification that defines the
declared, used and managed in the rules to support language integration in
runtime and facilitates cross- such a way that programs written in
language integration, type safety, any language, yet can interoperate with
and high performance code one another, taking full advantage of
execution. 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: Example:
“Integer” datatype in VB and A class written in C# can inherit from
“int” datatype in C++ are not a class written in VB.
compatible, so the interfacing
between them is very So we can say that using this
complicated. In order that two specification (CLSCompliant attribute)
different languages can in our programs (written in any
communicate, “Integer” in VB6 language), the type is forced to
and “int” in C++ will convert to conform to the rules of CLS and
System.int32 which is datatype of programs can interoperate with one
CTS. another, taking full advantage of
polymorphism, inheritance and other
(or) features.
2. 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/