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)
You can use this:
using System.Reflection;
// ...
ui.GetTypeInfo().IsAssignableFrom(type.GetTypeInfo());
This works in Metro.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With