vb.net – 如何确定某个类是否使用特定属性进行修饰

前端之家收集整理的这篇文章主要介绍了vb.net – 如何确定某个类是否使用特定属性进行修饰前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试确定界面是否使用特定属性进行修饰.例如,我有以下界面:
<MyCustomAttribute()> _
Public Interface IMyInterface
    Function Function1
    Sub DeleteWorkflowInstanceMap(ByVal instanceId As Guid)
    Sub InsertWorkflowInstanceMap(ByVal instanceId As Guid,ByVal aliasName As String)
End Interface

如何确定IMyInterface是否使用MyCustomAttribute属性进行修饰?

甚至比GetCustomAttributes更好的是Shared方法IsDefined:
Attribute.IsDefined(GetType(IMyInterface),GetType(MyCustomAttribute))

猜你在找的VB相关文章