What are boxing and unboxing?



What are boxing and unboxing?..

Answer / Sanjay Sharma

In C#, `boxing` is the implicit conversion of a value type (like int or struct) to an object, while `unboxing` is the explicit conversion of an object back to its original value type. Boxing allows value types to be stored in collections that can only hold objects, and unboxing retrieves the value from the object.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Sharp Interview Questions

What is class in oops with example in c#?

1 Answers  


What is the difference between method and constructor in c#?

1 Answers  


Why is c# a good programming language?

1 Answers  


Name some properties of thread class.

1 Answers  


What is dictionary class in c#?

1 Answers  


Why should you override the tostring() method?

1 Answers  


What are circular references? How garbage collection deals with circular references.

1 Answers  


What is Partial class? What purpose we use it?

6 Answers   ACS, TATA,


How does dependency injection work c#?

1 Answers  


Is typeof c#?

1 Answers  


What is a statement c#?

1 Answers  


i have a question which is quite simple but yet complicated for me my question is why do we use void, if it does not return anything to the compiler? if it is used for normal display it can also be done by what is called Console.Write() or Consol.WriteLine() and if i do not use void with my method then my compiler throws me an error. if i return a value say integer then i write public int fun() display of the result can also be done here then why is it so necessary to use void with a function and why so compiler throw us an error if v don't use void return type?

2 Answers  


Categories