.NET Windows Store Apps and System.Type - equivalent to operator ==?

.net, c#, equality, system.type, windows-store-apps

Solution

So the underlying principle here is that `Equals` is a virtual instance method of every type, meaning it will use the vtable to determine the implementation to use, at runtime, based on the type of the actual object that called `Equals` (disregarding the type of the variable).

`operator ==` can be thought of as a static method (with a lot of overloads). It is not virtual, so the implementation that is referred to will be based on the compile time type of the variable holding the object, and won't be based on what the actual type of the object is at runtime.

This behavior can be replicated by simply creating your own `static` `Equals` methods (on whatever type or types you prefer) that behave based on the types of the two arguments. This is slightly less convenient to type out than using `operator ==`, but does effectively the same thing once compiled.

Problem

According to the accepted answer to this StackOverflow question, there is a difference between the `System.Type.Equals` method and the `System.Type operator ==`: ``` a runtime type (represented by the internal type RuntimeType), managed by the CLR is not always the same as a Type, which can be extended. Equals will check the underlying system type, whereas == will check the type itself. ``` In .NET for Windows Store Apps, the System.Type operator == is not available. How can I completely reproduce the functionality of the `System.Type operator ==` in a Windows Store application? Or, is the specific equality operator functionality for `System.Type` not relevant in Windows Store apps?

Original source

Related problems