Certification Test Question:
Give an example that demostrates unboxing?
Answer:
Value type to object (boxing)
object back to value type (unboxing)
Example:
object o = 123;
int one2three = (int)o;
----------
object pi = 3.14159265
double dPI = (double)pi;
unboxing is object to ValueType
MSDN:
Unboxing extracts the value type from the object.
Showing posts with label Unboxing. Show all posts
Showing posts with label Unboxing. Show all posts
Wednesday, February 7, 2007
Subscribe to:
Posts (Atom)