Write the following code:
public class Class1
{
public static Type GetBaseType(Type type)
{
return type.BaseType;
}
}
Observe that you cannot compile: "'System.Type' does not contain a definition for 'BaseType' and no extension method 'BaseType' accepting a first argument of type 'System.Type' could be found (are you missing a using directive or an assembly reference?)"
Strange since the MSDN documentation clearly states this property should be present: http://msdn.microsoft.com/en-us/library/system.type.basetype(v=vs.110).aspx
It is not available in WinRT apps. Properties and methods supported in WinRT have this mentioned explicitly (look at the store icon) - http://msdn.microsoft.com/en-us/library/system.type(v=vs.110).aspx
This answer provides a workaround for WinRT - What is the equivalent to Type.BaseType in WinRT?
Type.GetTypeInfo().BaseType
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