To check if an object is of a given type in C#
:
if(myObj is MyClass)
{
//....
}
To check if it is not of a given type:
if(!(myObj is MyClass))
{
//....
}
Is there a more readable way to express the same logic?
For example, if I could write this it would be easier to read.
if(myObj is not MyClass)
{
//....
}