Apex Code to compare SObjects against other types in support of force.com blog entry
public class ObjectHelper{
public static boolean compareTypes(SObject compare, String checkType){
try{
Schema.SObjectType targetType = Schema.getGlobalDescribe().get(checkType);
if(targetType == null){
return false;
}else if( compare.getSObjectType() == targetType){
return true;
}
}catch(Exception e){
//handle exception
return false;
}
return false;
}
}