当前位置: 首页>>代码示例>>C#>>正文


C# IMethodSymbol.IsAsyncDelegate方法代码示例

本文整理汇总了C#中IMethodSymbol.IsAsyncDelegate方法的典型用法代码示例。如果您正苦于以下问题:C# IMethodSymbol.IsAsyncDelegate方法的具体用法?C# IMethodSymbol.IsAsyncDelegate怎么用?C# IMethodSymbol.IsAsyncDelegate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IMethodSymbol的用法示例。


在下文中一共展示了IMethodSymbol.IsAsyncDelegate方法的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;
        }
开发者ID:modulexcite,项目名称:concurrent-code-analyses,代码行数:24,代码来源:CPUAsyncDetectionWalker.cs

示例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;
        }
开发者ID:modulexcite,项目名称:CSharpAnalyzer,代码行数:37,代码来源:AsyncUsageDetectionWalker.cs


注:本文中的IMethodSymbol.IsAsyncDelegate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。