NDepend checkin Async后缀的规则

时间:2017-08-07 10:03:58

标签: ndepend

我想知道是否有最好的方法来执行此类检查。 我希望看到所有返回任务的方法(或任务,并且没有" Async"后缀)

// <Name>Task type should be called with Async suffix</Name>
from m in Application.Methods
where m.ReturnType!= null && m.ReturnType.NameLike("Task") && 
!m.NameLike("Async")
select m

1 个答案:

答案 0 :(得分:1)

您看过IMethod.IsAsync财产吗? http://www.ndepend.com/api/webframe.html?NDepend.API~NDepend.CodeModel.IMethod~IsAsync.html

from m in Application.Methods
where m.IsAsync
select m