Example #1
0
        public static IEnumerable <AttributeSyntax> GetAttributes <TAttr>(this MemberDeclarationSyntax node)
            where TAttr : Attribute
        {
            var attrShortName = GetAttributeShortName <TAttr>();

            return(node.AttributeLists()
                   .SelectMany(a => a.Attributes)
                   .Where(a => a.Name.ToString() == attrShortName));
        }
 public static MemberDeclarationSyntax AddAttributeLists(this MemberDeclarationSyntax syntax, params AttributeListSyntax[] items)
 {
     return(syntax.WithAttributeLists(syntax.AttributeLists().AddRange(items)));
 }