Ejemplo n.º 1
0
 private static void ChangeAnnotationAttribute(IMethodDeclaration methodDeclaration, string toReplace, ITypeElement replacement)
 {
     var toReplaceAttribute = methodDeclaration.Attributes
         .FirstOrDefault(a => string.Compare(a.Name.QualifiedName, toReplace, StringComparison.InvariantCultureIgnoreCase) == 0);
     if (toReplaceAttribute != null && replacement != null)
     {
         var annotation = CSharpAnnotationsUtil.Annotate(methodDeclaration, replacement);
         if (annotation.Status == CSharpAnnotationsUtil.Status.AnnotationInserted)
         {
             methodDeclaration.RemoveAttribute(toReplaceAttribute);
         }
     }
 }