public static bool HasAbstractOrVirtualEvents(this ClassDeclarationSyntax classDeclaration) { var events = classDeclaration.GetEvents(); foreach (var e in events) { var modifiers = e.Modifiers.Where(x => x.IsKind(SyntaxKind.AbstractKeyword) || x.IsKind(SyntaxKind.VirtualKeyword)); if (modifiers.Any()) { return(true); } } return(false); }