CSharp examples for Custom Type:Box Unbox
Check, cast and assign object
using System;/* w w w. j a va 2 s . co m*/ using static System.Console; using System.IO; class Program { static void Main(string[] args) { object o = 3; int j = 4; if (o is int i) { WriteLine($"{i} x {j} = {i * j}"); } else { WriteLine("o is not an int so it cannot multiply!"); } } }