How can I compare the types of two objects declared as type.
I want to know if two objects are of the same type or from the same base class.
Any help is apprecia
You can also use the "IS" keyword, if you expect the two object instances to be of a certain type. This will also work for comparing sub-classes to parent classes and also classes that implement interfaces and so forth. This will not work for types of type Type though.
if (objA Is string && objB Is string)
// they are the same.
public class a {}
public class b : a {}
b objb = new b();
if (objb Is a)
// they are of the same via inheritance