Question: 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?

Answer: 
see also the [Type.IsInstanceOfType](http://msdn.microsoft.com/en-us/library/system.type.isinstanceoftype%28VS.100%29.aspx) method in the .NET framework, if you want to test against a variable type
.NET 2010 beta 2 : tested against FrameWork 4, 3.5 ("full" FrameWork versions, not "Client Profile" versions)

*Given :*

```
public class Foo
{
    public Foo() {}
}

```

*And run-time execution of :*

```
Foo myFoo = new Foo();

Console.WriteLine(myFoo is Foo);

Console.WriteLine(typeof(Foo).IsInstanceOfType(myFoo));

```

The Console.WriteLine statements both print "True" to the Console Window.

Why do you think this prints 'False to the Console Window :

```
Console.WriteLine(myFoo.GetType().IsInstanceOfType(typeof(Foo)));

```