I notice that .NET core doesn't allow myObj.GetType().GetProperties()
as no GetProperties
method exists. Is there another way to obtain the properties of a class through reflection?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
Just to sum up to anyone else, just adding
using System.Reflection
to the top of the page is not enough. You will have to add theSystem.Reflection.TypeExtensions
NuGet package as described in the question comments.It seems that
myObj.GetType().GetProperties()
IS valid. I just had to bring in System.Reflection byusing System.Reflection
.