I don't know how I missed the is keyword in C#. I must have been asleep or something when I read about this. Up till now I've been getting the type of an object and comparing to the typeof() a class.

object foo = "bar";

if (foo is string)
{
    Console.WriteLine("foo is a string");
}

if (foo.GetType() == typeof(string))
{
    Console.WriteLine("foo is a string");
}