boxing means converting value type to reference type and
unboxing means converting reference type to value type.why
we need boxing and unboxing?
Answers were Sorted based on User's Feedback
Answer / uday
We use boxing and un-boxing when we assign a value to an
object and vice-versa.
Ex:
Int i=10;
Object o=i //this is boxing
int j=(int)o; //this is unboxing
When u say boxing, an object box is allocated and then the
value is copied to that box.
When u unbox, the value is copied out of the object box and
copied into storage location.
| Is This Answer Correct ? | 13 Yes | 2 No |
Answer / madhu maaydi
some times super class ref is may not available to subclass objects at that time we may go for umboxing, data in the web application travers in the net throuw objects only but not through variables at that time we need to type cast it into equalent obecjt at this time we go for boxing and auto boximg....
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / deepak
actually we need boxing and unboxing to keep more than one type of value type of variables in a common reference type of collection.. so that you can do the common operation in a loop or anywhere else.. by unboxing one by one.. also you can pass that collection to any method.. so you dont need to make many overloaded method for every type of value type..
| Is This Answer Correct ? | 0 Yes | 1 No |
Which class comes after the SortedList class?
Can a class be private in c#?
Can you pass parameters to destructors?
What can be done with c#?
How do you declare a method in c#?
How do you remove white spaces from a string?
Can a structure inherit a class.
I need code to connect ohter systems in the LAN and i want to display my website image over there and i want explain as a admin through phone. So i need code to access other system using C-Sharp. Any one please help me.Please give me the code. Advace thanks.
Why linq is having select clause at the end?
What is extended class in c#?
write code for inserting and updating recoards in sql server database using connected architecture & records shoulds displayed in grid view ( use c# )
What is GAC?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)