public static void ComputeRefactorings(RefactoringContext context, AnonymousMethodExpressionSyntax anonymousMethod)
 {
     if (context.IsRefactoringEnabled(RefactoringIdentifiers.UseLambdaExpressionInsteadOfAnonymousMethod) &&
         UseLambdaExpressionInsteadOfAnonymousMethodAnalysis.IsFixable(anonymousMethod))
     {
         context.RegisterRefactoring(
             "Use lambda expression instead of anonymous method",
             ct => UseLambdaExpressionInsteadOfAnonymousMethodRefactoring.RefactorAsync(context.Document, anonymousMethod, ct));
     }
 }
Exemple #2
0
 public static void ComputeRefactorings(RefactoringContext context, AnonymousMethodExpressionSyntax anonymousMethod)
 {
     if (context.IsRefactoringEnabled(RefactoringIdentifiers.UseLambdaExpressionInsteadOfAnonymousMethod) &&
         UseLambdaExpressionInsteadOfAnonymousMethodRefactoring.CanRefactor(anonymousMethod))
     {
         context.RegisterRefactoring(
             "Use lambda expression instead of anonymous method",
             cancellationToken =>
         {
             return(UseLambdaExpressionInsteadOfAnonymousMethodRefactoring.RefactorAsync(
                        context.Document,
                        anonymousMethod,
                        cancellationToken));
         });
     }
 }