Finding all methods that handle form events using NDepend

I was wondering if someone would be able to help me write a CQL query for NDepend that will show me all the methods in my form class that handle the form events. So I would like to be able to find all the methods that look like this:

Private Sub AddFolderButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddFolderButton.Click

I have had a look through some of the options but I can't really find anything that does what I need.

I have only just started using NDepend, so I haven't really got used to it yet, but I do know one thing how the hell did I live without it all this time.


我是NDepend团队的Patrick,我确认,迄今为止,在'方法名称+签名'中使用'Namelike +正则表达式'条件是实现CQL所需的最佳方式。


I have sort of got something that works but its not really 100% correct, because all the form generated event handlers have an underscores in there name, I used the underscore as a filter, I also filter where the name has "EventArgs" in it. The query looks like this:

SELECT METHODS WHERE NameLike "_" OR NameLike "EventArgs" AND !IsSpecialName AND IsPrivate 

That query pretty much returns all the methods that handle events but I would still like to find a more correct way.

链接地址: http://www.djcxy.com/p/37718.html

上一篇: N缺少IDisposable实现的CQL查询

下一篇: 使用NDepend查找处理表单事件的所有方法