Saturday, 31 January 2015

Boxing and Unboxing

Boxing.

In c# programming language by Boxing we mean to converting a value type to a type object or to the interface type implemented same value type. CLR wraps the value inside the system.object and store it in the garbage-collected heap. Boxing is an implicit conversion.

The example of boxing is as below:


int a = 12;
object val = a;
//The above line is boxing variable a ant its value.


Unboxing.

Unboxing is an explicit conversion from the type to a value type or from an interface type to a value type that implements the interface. An unboxing  operation is consist of checking the object instance to make sure that it is a boxed value of given value type and copying the the instance to value type variable.

The example of unboxing is as below:

int a = 12;
object val = a;    //Boxing.
int w =(int) val;       //Unboxing.

Thursday, 29 January 2015

Introduction to C# Programming Language

C# is a simple, general purpose, modern, component oriented, object oriented language having some concept from other programming language, mostly from java. It was developed by Microsoft within its .NET initiative and later approved as a standard by Ecma (ECMA-334) and ISO (ISO/IEC 23270:2006) appeared in 2000.The most recent version is C# 5.0, which was released on August 15, 2012.

 C# is used in combination with the .NET framework. That's why application written in C#, requires the .NET framework to be installed on the computer running the application. C# does not offer global variance and function. Every thing is wrapped in classes even if you want to print a single string or integer you need a class for it which inherits the system object class.

C# can be written with any text editor, like Windows Notepad, and then compiled with the C# Command line compiler, csc.exe, which comes with the .NET framework. Mostly uses an IDE(Integrated Development Environment) and Microsoft also provide some other option.
Visual Studio is their flagship, which can use to work on every possible aspect of .Net Framework having its own various versions. But the visual studio is not cheap and very advanced for the hobby programmers.

After some time Microsoft introduce Express Version targeting hobby programmer with .NET Framework 2.0. Express Version is free of cost and just fine for the learning programmers.

I highly recommend you to Download Visual Studio Express Edition of C# from the following link: http://www.visualstudio.com/en-us/products/visual-studio-community-vs.



Ref:
1.www.visualstudio.com
2.www.csharp.net-tutorials.com
3.www.wikipedia.org.