keyword when we want to see if we can cast form one type to another,if the cast is not valid then the ''as'' operator will return null.
"instance.GetType()==typeof(Class) " is not always equal "instance is Class".there will one problem when we use inheritance.
BasePage inherits form Page,and BasePage inherits also from object,so if we
test for(new BasePage()).GetType()==typeof(object) it'll return false because
the types are different,but when we test using the is operator it's true.
((new BasePage()) is object) is true because (new BasePage()) is an object of type BasePage, and also a Page and an object. The types might be different , but is operator checks whethere we can cast safely to this type.
this same pattern can be applied to both value types (like a System.Int32) and reference types (like an XmlDocument):
typeof() is an operator and GetType() is a method defined in System.Object an both of them returns and object of System.Type.
There are times when GetType is useful, but if the Type is well known to you then use typeof.
Type aType = typeof(DateTime);
By using the is operator, GetType method, and typeof keyword, we can effectively manage type information and solve several problems in various ways.