Thursday, July 21, 2011

Frequently used terms in .Net Framework


Garbage Collection

This is the means by which the CLR cleans up memory that is no longer needed, freeing applications from having to take responsibility for this.

Generations

Generations provide a means for the Garbage Collector to identify recently created objects versus long-lived objects. An object's generation is basically a counter that indicates how many times it has successfully avoided garbage collection. In version 1.0 of the .NET Framework, an object's generation counter starts at zero and can have a maximum value of two.

Common Language Runtime (CLR)

 CLR is .NET Runtime which actually manages your code.

•It provides a simple and robust way to manage diff versions of code, thereby simplifying the process   of deploying an application.
 •Garbage Collector is responsible for freeing up memory of objects that are no longer referenced by an application.
 •CLR enables managed code (i.e. code that is compiled to run under the control of the CLR) written in one language to integrate seamlessly with code written in another language. This includes cross-language inheritance, exception handling, marshalling of data and debugging.
 •.NET applications expose rich metadata that contains information about the types an application exposes, its dependencies on other .NET applications, and memory layout for objects.


A .NET application is composed of 3 primary entities: Assemblies, Modules and Types.

Assemblies

 Assembly is the primary unit of deployment of .NET application. It is a unit in which compiled managed code is stored. It is either a dynamic link library (DLL) or an executable (EXE). An assembly is composed of a manifest, one or more modules, and other files that contain HTML, XML, images and so on.

Each assembly has one and only one assembly manifest, and it contains all the description information (types, methods) for the assembly. The assembly manifest can be contained in its own separate file, or it can be contained within one of the assembly's modules. When you compile a project into an assembly, your code is converted from high-level code to IL. When you compile a .NET application, it is not compiled to binary machine code; rather it is converted to IL, which is a low-level set of instructions understood by the CLR.


Modules

Modules are the individual files that make up an assembly.

Types

 Type is the basic units that encapsulate data and behavior.

Delegates

 Delegate allows you to write code that can dynamically change the methods that it calls.

  • It allows a method to be called indirectly. 
  • It contains a reference to a method. 
  • All methods invoked by the same delegate must have the same parameters and return value.
A delegate is similar to an interface. It specifies a contract between a caller and an implementer. To use a delegate you must first define it and then instantiate it.

Following is the syntax to define a delegate:


public delegate void MyDelegate();


Application Domains

Operating systems and runtime environments typically provide some form of isolation between applications. This isolation is necessary to ensure that code running in one application cannot adversely affect other, unrelated applications.


 Application domains provide a secure and versatile unit of processing that the common language runtime can use to provide isolation between applications. Application domains are typically created by runtime hosts, which are responsible for bootstrapping the common language runtime before an application is run.


Reflection

Reflection is a mechanism, which helps you in obtaining all the details about the object, like methods and properties, at runtime. Because assemblies are entirely self-describing, this opens the theoretical possibility of programmatic access to assembly metadata. There are in fact some base classes that are designed to achieve this. The technology is known as reflection.


Static Constructor

Static Constructors will only ever be executed once, as opposed to the instance (normal) constructors, and it is executed whenever an object of that class is created. One reason why you might want a static constructor is to initialize the values of any static variables.


Managed Code

Any code that is designed to run within the .NET environment is referred to as managed code. Other code, which simply runs on Windows, outside .NET, is unmanaged code.


Global Assembly Cache (GAC)

This is the area of disk in which shared assemblies are stored.


Common Language Specification (CLS)

This is a minimum set of standards that guarantees that code can be accessed from any language. All compilers that target .NET should support the CLS.


Just-in-Time (JIT) Compilation

This is the term for the process of performing the final stage of compilation from Intermediate Language into native machine code. It gets its name because portions of the code are compiled as required.

Manifest

Manifest is the area of an assembly that contains metadata.

 Application Domain
 
Application Domains are a means by which the CLR allows different code to run in the same process space. Isolation between these code units is achieved by using the type safety of IL to verify prior to execution that each segment of code is well behaved.

Boxing

Boxing is an implicit conversion of a value type to the type object.
Boxing an object value copies the value into the new object. For example:
int v = 5;
The following statement implicitly applies the boxing operation on the variable v:
object o = v;
Here, o is a copy of variable v.

Unboxing

Unboxing is an explicit conversion from the type object to a value type. An unboxing operation consists of:
•Checking the object instance to make sure it is a boxed value of the given value type.
•Copying the value from the instance into the value-type variable.
The following example demonstrate both boxing and unboxing operations:
int v = 5; // A value type
 object o = v; // Boxing
 int i = (int)o; // Unboxing

.NET Framework versions


Version Version NumberRelease DateVisual Studio
1.01.0.3705.02002-02-13Visual Studio .NET
1.11.1.4322.5732003-04-24Visual Studio .NET 2003
2.02.0.50727.422005-11-07Visual Studio 2005
3.03.0.4506.302006-11-06
3.53.5.21022.82007-11-19Visual Studio 2008
4.04.0.30319.12010-04-12Visual Studio 2010

The .NET Framework allows you to:


  • Apply common skills across a variety of devices, application types, and programming tasks

  • Integrate with other tools and technologies to build the right solution with less work

  • Build compelling applications faster

  • The .NET Framework is :


    • Common Language Runtime – provides an abstraction layer over the operating system.   
    • Base Class Libraries – pre-built code for common low-level programming tasks.  
    • Development frameworks and technologies – reusable, customizable solutions for larger programming tasks.