Monday, 16 January 2012

How to apply "Multi-targeting feature" in ASP.NET 4.0

What is Multi-Targeting:
Multi-Targeting is a feature given in .Net 4.0 that can be used to target a specific version of .Net framework for creating applications.

Limitation in previous versions:
In the previous versions of .NET , the option of targeting some other framework was not available. Users could work in the same version, they installed.

How to use Multi-Targeting Feature:
For using multi-targeting feature , users will have to add “targetframework” attribute in the compilation element of the web.config file.
Example: You will find compilation element after “Caching” attribute.
You can also set this feature in Visual Studio 2010.Just follow these steps:
1: Open Visual Studio 2010.
2: Create NewProject/Website.
3: Select targetframework as shown below-
Now MultiTargeting feature will work according to your choice.

Multi-targeting allows you to use and target multiple versions of .NET.

Tuesday, 10 January 2012

Common Language Specification (CLS)

CLS (Common Language Specification):

CLS stands for “COMMON LANGUAGE SPECIFICATION”. CLS is a subset of COMMON TYPE SYSTEM. It is like an accord among language designer and class library designer to use a common set of basic language feature which all .NET language are expected to support.

The idea behind using CLS-compliant type in our programs is to give capability so that programs can interoperate with any .NET program written in any language like(c#, VB, F# etc). 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 your 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.

Sunday, 8 January 2012

Common Type System(CTS)

Common Type System:

CTS describes full range of types that the .NET runtime uses and manages in runtime and provide cross language integration, type safety and high performance code execution.. However note that not all .NET languages support all the types in the CTS.CTS is strict type and code verification infrastructure and enable the managed code to consume other managed types and enforce strict fidelity and type safety.

Functions of CTS:
  • CTS provide an environment for the implementation of many programming languages. This environment is totally Object Oriented.
  • CTS defines a rule through which objects written in different languages can interact with each other.
  • CTS also defines rules through which data types of objects written in various languages can interact with each other.
  • Virtual method, type visibility and type governing rules are also described in CTS.

 The common type system supports two general categories of types:
·         Value types hold their data directly, and instances of value types are either allocated on the stack or allocated inline in a structure.
·         Reference types store a reference to the value's memory address, and are allocated on the heap.