View Single Post
  #2 (permalink)  
Old July 5th, 2006, 06:46 AM
anujrathi anujrathi is offline
Authorized User
Points: 375, Level: 6
Points: 375, Level: 6 Points: 375, Level: 6 Points: 375, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2006
Location: New Delhi,India.
Posts: 79
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via AIM to anujrathi Send a message via MSN to anujrathi Send a message via Yahoo to anujrathi
Default

Hi friend,

First of all, u hav written wrong.
It is UnBoxing no InBoxing.

Lets see:

When u want to use a integer in any string or u want to convert any integer variable into string, U simply write

string s= 20.ToString();

This is called Boxing, means u hav a value type & u want a reference type then the Compiler create an object Box into which it places the value of value type.

eg.

int n=5;
//Create a box to hold the value of n
object obj=n;
//U know thar object is the datatype that can hold any data type

//Now u wnat to use ur integer value again, so u will unbox it
int m = (int)obj;

when u will do unboxing, Casting is must. If u will not do, thenm compiler will generate an error.

Regards,
Anuj Rathi