x2b*_*ool 4 .net c# reflection coreclr asp.net-core
我试图从类中获取属性,似乎没有GetCustomAttributes方法.如何在CoreCLR中获取属性?
using System.Reflection;
class FooBar {
FooBar() {
GetType().GetCustomAttributes(); // does not compile
GetType().GetField("test").GetCustomAttributes(); // compiles
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2599 次 |
| 最近记录: |