Mat*_*teS 14 c# attributes typedescriptor
我可以使用TypeDescriptor.AddAttributes在运行时向属性添加属性.如何为方法和参数执行相同的操作?(也许2个单独的问题......)
Mar*_*ell 17
TypeDescriptor.AddAttributes只影响一个非常具体的用例; 即从内部System.ComponentModel.对于其余的反射,它对额外属性一无所知.事实上,System.ComponentModel并不真正适用于方法或参数.
所以总之; 你不能.您需要将此信息存储在其他位置(定制),或者在编译时添加它.