我注意到 .NET 核心不允许 myObj.GetType().GetProperties()
因为不存在 GetProperties
方法。还有其他方法可以通过反射获取类的属性吗?
最佳答案
看来 myObj.GetType().GetProperties()
是有效的。我只需通过 using System.Reflection
引入 System.Reflection。
关于c# - 在 .NET Core 中获取类的公共(public)属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40579285/