本文整理汇总了C#中IMethodSymbol.IsTaskCreationMethod方法的典型用法代码示例。如果您正苦于以下问题:C# IMethodSymbol.IsTaskCreationMethod方法的具体用法?C# IMethodSymbol.IsTaskCreationMethod怎么用?C# IMethodSymbol.IsTaskCreationMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMethodSymbol
的用法示例。
在下文中一共展示了IMethodSymbol.IsTaskCreationMethod方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DetectCPUAsynchronousUsages
private Enums.AsyncDetected DetectCPUAsynchronousUsages(InvocationExpressionSyntax methodCall, IMethodSymbol methodCallSymbol)
{
var methodCallName = methodCall.Expression.ToString().ToLower();
// DETECT CPU-BOUND ASYNC CALLS
if (methodCallSymbol.IsThreadStart())
return Enums.AsyncDetected.Thread;
else if (methodCallSymbol.IsThreadPoolQueueUserWorkItem())
return Enums.AsyncDetected.Threadpool;
else if (methodCallSymbol.IsAsyncDelegate())
return Enums.AsyncDetected.AsyncDelegate;
else if (methodCallSymbol.IsBackgroundWorkerMethod())
return Enums.AsyncDetected.BackgroundWorker;
else if (methodCallSymbol.IsTaskCreationMethod())
return Enums.AsyncDetected.Task;
else if (methodCallSymbol.IsParallelForEach())
return Enums.AsyncDetected.ParallelForEach;
else if (methodCallSymbol.IsParallelFor())
return Enums.AsyncDetected.ParallelFor;
else if (methodCallSymbol.IsParallelInvoke())
return Enums.AsyncDetected.ParallelInvoke;
else
return Enums.AsyncDetected.None;
}
示例2: DetectAsynchronousUsages
private Enums.AsyncDetected DetectAsynchronousUsages(InvocationExpressionSyntax methodCall, IMethodSymbol methodCallSymbol)
{
var methodCallName = methodCall.Expression.ToString().ToLower();
// DETECT ASYNC CALLS
if (methodCallSymbol.IsThreadStart())
return Enums.AsyncDetected.Thread;
else if (methodCallSymbol.IsThreadPoolQueueUserWorkItem())
return Enums.AsyncDetected.Threadpool;
else if (methodCallSymbol.IsAsyncDelegate())
return Enums.AsyncDetected.AsyncDelegate;
else if (methodCallSymbol.IsBackgroundWorkerMethod())
return Enums.AsyncDetected.BackgroundWorker;
else if (methodCallSymbol.IsTaskCreationMethod())
return Enums.AsyncDetected.Task;
//// DETECT GUI UPDATE CALLS
//else if (methodCallSymbol.IsISynchronizeInvokeMethod())
// return Enums.AsyncDetected.ISynchronizeInvoke;
//else if (methodCallSymbol.IsControlBeginInvoke())
// return Enums.AsyncDetected.ControlInvoke;
//else if (methodCallSymbol.IsDispatcherBeginInvoke())
// return Enums.AsyncDetected.Dispatcher;
// DETECT PATTERNS
else if (methodCallSymbol.IsAPMBeginMethod())
return Enums.AsyncDetected.APM;
else if (methodCall.IsEAPMethod())
return Enums.AsyncDetected.EAP;
else if (methodCallSymbol.IsTAPMethod())
return Enums.AsyncDetected.TAP;
else
return Enums.AsyncDetected.None;
}