Is there any alternative for IsSubclassOf
or IsAssignableFrom
in C# Metro-style?
I'm trying to make this code run on Metro but can't find alternative.
if ((ui.GetType() == type) || (ui.GetType().IsSubclassOf(type)))
{
return true;
}
Many of the reflection methods can be found in the System.Reflection.TypeInfo
class.
You can get an instance of TypeInfo
for your Type
using the GetTypeInfo
extension method, provided by System.Reflection.IntrospectionExtensions
:
using System.Reflection;
// ...
ui.GetType().GetTypeInfo().IsSubclassOf(type)