c# - 在 .NET Core 中获取类的公共(public)属性

标签 c# .net-core

我注意到 .NET 核心不允许 myObj.GetType().GetProperties() 因为不存在 GetProperties 方法。还有其他方法可以通过反射获取类的属性吗?

最佳答案

看来 myObj.GetType().GetProperties() 是有效的。我只需通过 using System.Reflection 引入 System.Reflection。

关于c# - 在 .NET Core 中获取类的公共(public)属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40579285/

相关文章:

c# - C# 和 VB 中的 Overridable 和 Override

c# - .net core2 Data isn't null 但 View Keep saying Data is Null

c# - InMemoryDbContext 在种子之后不会持续存在, Controller 中的集合始终为空

c# - Reverse String.Replace - 更快的方法?

.NET 4.0 中的 C# Task.Run 等价物

c# - DataContractSerializer 反序列化没有命名空间的成员?

C#PDFSharp : Examples of how to strip text from PDF?

.net-core - 为什么微软将 AppDomain 带回 .NET Core 3.0?

c# - 计算 .NET Core 项目的代码指标?

c# - 将选项模式与 Azure Key Vault 结合使用?