C# type checking with the is statement

A var type can be checked using the ‘is’ statement

var a = 1.0;

if (a is int)
{
    MessageBox.Show("int");
}
else
{
    MessageBox.Show("is NOT int");
}

Leave a Reply