.net core equivalent for GetCustomAttribute on ass

2019-07-27 17:35发布

问题:

I cannot find a .net core equivalent for calling GetCustomAttributes on an assembly object. I see there is CustomAttributes property, but this doesn't return instances of the custom attributes, but rather metadata about the attributes. How can I retrieve the actual attribute instance?

回答1:

There's a GetCustomAttributes extension method. Just add using System.Reflection.