boxing means converting value type to reference type and
unboxing means converting reference type to value type.why
we need boxing and unboxing?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

List the difference between the virtual method and the abstract method?

489


What is multidimensional array in c#?

460


Can hashtable have duplicate keys?

495


What is an escape sequence?

512


Which is better javascript or c#?

499






What is the difference between User controls and Custom Controls?

550


What are the different states of a thread?

530


What is parsing? How to parse a date time string?

534


Whats an assembly? Describe the importance of assembly?

495


What is the default value of object in c#?

452


What is a static in c#?

490


What's the c# syntax to catch any possible exception?

488


What is difference between struct and class in c#?

467


What is a c sharp?

462


How many bytes is a char c#?

484