How to determine if a Generic Type property is in DNX Core 5.0?

Previously, I could use this to get common types in a class;

typeof(MyClass).GetTypeInfo().DeclaredProperties.Any(p => p.PropertyType.IsGenericType)

However, in DNX Core 5.0 is IsGenericTypenot supported. What can i use now?

+4
source share
1 answer

I just looked at the source, confirming that the IsGenericType property is still in the structure.

https://github.com/aspnet/Common/blob/dev/src/Microsoft.Framework.ClosedGenericMatcher.Sources/ClosedGenericMatcher.cs#L44

Is the following being done?

typeof(MyClass).GetTypeInfo().DeclaredProperties.Any(p => p.PropertyType.GetTypeInfo().IsGenericType)
+8
source

Source: https://habr.com/ru/post/1607753/


All Articles