Example #1
0
        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));
        }
Example #2
0
        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));
        }
Example #3
0
        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);
        }