-
-
Save gdyrrahitis/7bea82fca0fe1dbc06b7d57af27580e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void BoxingUnboxing() | |
{ | |
int x = 10; | |
double y = x; // This is fine | |
object o = x; | |
double z = (double)o; // Unhandled Exception: System.InvalidCastException: | |
// Unable to cast object of type 'System.Int32' to type 'System.Double'. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment