diff options
Diffstat (limited to 'src/mscorlib/shared/System/Reflection/IntrospectionExtensions.cs')
-rw-r--r-- | src/mscorlib/shared/System/Reflection/IntrospectionExtensions.cs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mscorlib/shared/System/Reflection/IntrospectionExtensions.cs b/src/mscorlib/shared/System/Reflection/IntrospectionExtensions.cs index 6a18fdaa72..acf5987d44 100644 --- a/src/mscorlib/shared/System/Reflection/IntrospectionExtensions.cs +++ b/src/mscorlib/shared/System/Reflection/IntrospectionExtensions.cs @@ -13,7 +13,10 @@ namespace System.Reflection if (type == null) throw new ArgumentNullException(nameof(type)); - return ((IReflectableType)type).GetTypeInfo(); // Unguarded cast is unbecoming but kept for compatibility. + if (type is IReflectableType reflectableType) + return reflectableType.GetTypeInfo(); + + return new TypeDelegator(type); } } } |