In .Net we have Type.IsClass
to check if a type is a class using System.Reflection
.
But in .Net Core no. So, how can I check?
In .Net we have Type.IsClass
to check if a type is a class using System.Reflection
.
But in .Net Core no. So, how can I check?
This is ok, on: .net Core 1.1
using System.Reflection;
bool isClass = obj.GetType().GetTypeInfo().IsClass;
In .NET Core 2.2 you can do:
bool isClass = obj.GetType().IsClass;
The following will no longer work:
bool isClass = obj.GetTypeInfo().IsClass;
bool isClass = obj.GetType().GetTypeInfo().IsClass;