In C# does the "is" keyword always have to be followed by a class?

c#, class

Solution

see also the Type.IsInstanceOfType method in the .NET framework, if you want to test against a variable type

Problem

In Actionscript you can have a variable hold a reference to a class type and then compare an instance of a class to the variable with `is`. Example: ``` var a:Foo = new Foo(); var type:Class = Foo; if(a is type){ //this is true //do something } ``` Can you do something similar in C#? Or does the "is" keyword always have to be followed by a class?

Original source