Home
Q&A
Education
Technology
Credit
General
Health
Insurance
Questions
Ask a Question
What is the difference between boxing and unboxing in C#?
Home
Education
What is the difference between boxing and...
asked
Mar 31, 2021
in
Education
by
JackTerrance
What is the difference between boxing and unboxing in C#?
c-sharp-interview-questions
1
Answer
0
votes
answered
Mar 31, 2021
by
JackTerrance
Boxing and Unboxing are both used for type converting, but have some differences:
Boxing
Boxing is the process of converting a value type data type to the object or to any interface data type which is implemented by this value type. When the CLR boxes a value means when CLR converting a value type to Object Type, it wraps the value inside a System.Object and stores it on the heap area in the application domain.
Example
Unboxing
Unboxing is also a process that is used to extract the value type from the object or any implemented interface type. Boxing may be done implicitly, but unboxing has to be explicit by code.
Example:
The concept of boxing and unboxing underlies the C# unified view of the type system in which a value of any type can be treated as an object.
Related questions
0
votes
Q: What is Boxing and Unboxing in C#?
What is Boxing and Unboxing in C#?...
asked
Jul 9, 2021
in
General
by
JackTerrance
c-sharp-interview-questions
0
votes
Q: What is the difference between late binding and early binding in C#?
What is the difference between late binding and early binding in C#?...
asked
Mar 31, 2021
in
Education
by
JackTerrance
c-sharp-interview-questions
0
votes
Q: What is the difference between String and StringBuilder in C#?
What is the difference between String and StringBuilder in C#?...
asked
Mar 31, 2021
in
Education
by
JackTerrance
c-sharp-interview-questions
0
votes
Q: What is the difference between Static and Dynamic resources?
What is the difference between Static and Dynamic resources?...
asked
Apr 9, 2021
in
Education
by
JackTerrance
c-sharp-interview-questions
wpf-interview-questions-and-answers
0
votes
Q: What is the difference between MVP, MVC and MVVM?
What is the difference between MVP, MVC and MVVM?...
asked
Apr 9, 2021
in
Education
by
JackTerrance
c-sharp-interview-questions
asp-net-mvc-interview-questions
wpf-interview-questions-and-answers
0
votes
Q: What is the difference between Server.Transfer and Response.redirect?
What is the difference between Server.Transfer and Response.redirect?...
asked
Apr 7, 2021
in
Education
by
JackTerrance
c-sharp-interview-questions
asp-net-mvc-interview-questions
0
votes
Q: What is the difference between HttpContext.Current.Items and HttpContext.Current.Session in ASP.NET?
What is the difference between HttpContext.Current.Items and HttpContext.Current.Session in ASP.NET?...
asked
Apr 7, 2021
in
Education
by
JackTerrance
c-sharp-interview-questions
asp-net-mvc-interview-questions
0
votes
Q: What is the Difference between session and caching?
What is the Difference between session and caching?...
asked
Apr 7, 2021
in
Education
by
JackTerrance
c-sharp-interview-questions
asp-net-mvc-interview-questions
0
votes
Q: What is difference between MVC and Web Forms?
What is difference between MVC and Web Forms?...
asked
Apr 5, 2021
in
Education
by
JackTerrance
c-sharp-interview-questions
asp-net-mvc-interview-questions
0
votes
Q: What is the difference between WCF and Web services?
What is the difference between WCF and Web services?...
asked
Apr 1, 2021
in
Education
by
JackTerrance
c-sharp-interview-questions
0
votes
Q: What is a Hashtable in C#?
What is a Hashtable in C#?...
asked
Apr 1, 2021
in
Education
by
JackTerrance
c-sharp-interview-questions
0
votes
Q: What is Serialization in C#?
What is Serialization in C#?...
asked
Apr 1, 2021
in
Education
by
JackTerrance
c-sharp-interview-questions
0
votes
Q: What is IEnumerable<> in C#?
What is IEnumerable in C#?...
asked
Mar 31, 2021
in
Education
by
JackTerrance
c-sharp-interview-questions
0
votes
Q: What are sealed classes in C#?
What are sealed classes in C#?...
asked
Mar 31, 2021
in
Education
by
JackTerrance
c-sharp-interview-questions
0
votes
Q: What are extension methods in C#?
What are extension methods in C#?...
asked
Mar 31, 2021
in
Education
by
JackTerrance
c-sharp-interview-questions
...