- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is unboxing in C#?
Boxing is implicit and unboxing is explicit. Unboxing is the explicit conversion of the reference type created by boxing, back to a value type.
Let us see an example of variable and object in C# −
// int int x = 30; // Boxing object obj = x; // Un boxing int unboxInt = (int) obj;
The following is an example showing Un boxing −
int x = 5; ArrayList arrList = new ArrayList(); // Boxing arrList.Add(x); // UnBoxing int y = (int) arrList [0];
Advertisements