private static EnumDeclarationSyntax AddBaseClass(this EnumDeclarationSyntax @this, String @classTypeName) { return @this.AddBaseListTypes( SyntaxFactory.SimpleBaseType( SyntaxFactory.ParseTypeName( SyntaxFactory.Identifier(@classTypeName).ToFullString()))); }
internal static ClassDeclarationSyntax WithINotifyPropertyChangedInterface(this ClassDeclarationSyntax classDeclaration) { if (!(classDeclaration.BaseList?.Types.Any(x => { var t = x.Type.ToString(); return t == "INotifyPropertyChanged" || t == "System.ComponentModel.INotifyPropertyChanged"; }) ?? false)) { var inpc = SyntaxFactory.ParseTypeName("System.ComponentModel.INotifyPropertyChanged") .WithAdditionalAnnotations(Simplifier.Annotation) .WithAdditionalAnnotations(Formatter.Annotation); var decl = classDeclaration.AddBaseListTypes(SyntaxFactory.SimpleBaseType(inpc)); return decl.WithIdentifier(decl.Identifier.WithTrailingTrivia()); } else { return classDeclaration; } }