private SyntaxNode CreateFullProperty(PropertyDeclarationSyntax property, char?backingFiledPrefix, string methodNameToNotifyThatPropertyWasChanged, SyntaxGenerator syntaxGenerator) { string propertyName = property.Identifier.ValueText; string fieldName = FieldNameGenerator.Generate(propertyName, backingFiledPrefix); return(syntaxGenerator.FullPropertyDeclaration(propertyName, property.Type, fieldName, methodNameToNotifyThatPropertyWasChanged)); }
private SyntaxNode CreateFullProperty(PropertyDeclarationSyntax property, char?backingFiledPrefix, string methodNameToNotifyThatPropertyWasChanged, SyntaxGenerator syntaxGenerator) { string propertyName = property.Identifier.ValueText; string fieldName = FieldNameGenerator.Generate(propertyName, backingFiledPrefix); var leadingTrivia = property.GetLeadingTrivia(); var trailingTrivia = property.GetTrailingTrivia(); return(syntaxGenerator.FullPropertyDeclaration(propertyName, property.Type, property.AttributeLists, leadingTrivia, trailingTrivia, fieldName, methodNameToNotifyThatPropertyWasChanged)); }
private List <SyntaxNode> CreateBackingFields(IEnumerable <PropertyDeclarationSyntax> properties, char?backingFiledPrefix, SyntaxGenerator syntaxGenerator) { var createdBackingFields = new List <SyntaxNode>(); foreach (PropertyDeclarationSyntax property in properties) { string propertyName = property.Identifier.ValueText; string fieldName = FieldNameGenerator.Generate(propertyName, backingFiledPrefix); var createdField = syntaxGenerator.FieldDeclaration(fieldName, property.Type, Accessibility.Private); createdBackingFields.Add(createdField); } return(createdBackingFields); }