Checking compatibility without casting

suggest change

If you need to know whether a value’s type extends or implements a given type, but you don’t want to actually cast it as that type, you can use the is operator.

if (value is int)
{
   Console.WriteLine(value + "is an int");
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents