Unbox of an object to an int in CSharp
Description
The following code shows how to unbox of an object to an int.
Example
using System;// www. ja v a 2 s.co m
class MainClass {
public static void Main() {
object myObject = 3;
int myInt3 = (int)myObject; // myObject is unboxed
Console.WriteLine("myInt3 = " + myInt3);
}
}
The code above generates the following result.