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 / 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 |
Post New Answer View All Answers
What is the data provider name to connect to access database?
What is pure abstract class in c#?
What are different types of classes in c#?
Differentiate between method overriding from method overloading with its functionality?
Write a console application and implement the ternary operator to decide whether the age a user entered after being prompted is allowed to vote or not(given that only citizens between 18 and 120 years only inclusive can vote). Use exception handling for non-numerical input.
Write a sample code to write the contents to text file in c#?
Expalin the way you implement inheritance by using VB.NET/C#?
What is default class in c#?
What's different between c# and c/c++?
What are object pooling and connection pooling and difference? Where do we set the Min and Max Pool size for connection pooling?
What is ilist c#?
Explain how do I convert a string to an int in c#?
What is reference types in c#?
Why do we need to call CG.SupressFinalize?
How can it prevents DLL Hell assembly versioning in .NET?