【发布时间】:2016-11-10 19:42:32
【问题描述】:
我找不到在程序集对象上调用 GetCustomAttributes 的 .net 核心等效项。我看到有 CustomAttributes 属性,但这不会返回自定义属性的实例,而是返回有关属性的元数据。如何检索实际的属性实例?
【问题讨论】:
-
指的是类型,正如我在代码中看到的,GetTypeInfo 不存在用于汇编?
标签: reflection .net-core
我找不到在程序集对象上调用 GetCustomAttributes 的 .net 核心等效项。我看到有 CustomAttributes 属性,但这不会返回自定义属性的实例,而是返回有关属性的元数据。如何检索实际的属性实例?
【问题讨论】:
标签: reflection .net-core
有一个GetCustomAttributes 扩展方法。只需添加using System.Reflection。
【讨论】: