public IEnumerable <MemberDeclarationSyntax> GetQualifyingDeclarations(ClassDeclarationSyntax cls) { // we care about public static methods, properties and events var methods = cls.GetDeclarations <MethodDeclarationSyntax>() .Where(m => m.Modifiers.Contains(SyntaxKind.PublicKeyword) && m.Modifiers.Contains(SyntaxKind.StaticKeyword)) .Select(m => m.WithModifiers(new SyntaxTokenList())); var properties = cls.GetDeclarations <PropertyDeclarationSyntax>() .Where(m => m.Modifiers.Contains(SyntaxKind.PublicKeyword) && m.Modifiers.Contains(SyntaxKind.StaticKeyword)); var events = cls.GetDeclarations <EventDeclarationSyntax>() .Where(m => m.Modifiers.Contains(SyntaxKind.StaticKeyword)); return(Enumerable.Concat <MemberDeclarationSyntax>(methods, properties).Concat(events)); }