Example #1
0
        private static MemberDeclarationSyntax GenerateBackingField(ExpandablePropertyInfo property, Workspace workspace)
        {
            var g = SyntaxGenerator.GetGenerator(workspace, LanguageNames.CSharp);
            var type = g.TypeExpression(property.Type);

            var fieldDecl = (FieldDeclarationSyntax)ParseMember(string.Format("private _fieldType_ {0};", property.BackingFieldName));
            return fieldDecl.ReplaceNode(fieldDecl.Declaration.Type, type).WithAdditionalAnnotations(Formatter.Annotation);
        }
        private static MemberDeclarationSyntax GenerateBackingField(ExpandablePropertyInfo property, Workspace workspace)
        {
            SyntaxGenerator g    = SyntaxGenerator.GetGenerator(workspace, LanguageNames.CSharp);
            SyntaxNode      type = g.TypeExpression(property.Type);

            FieldDeclarationSyntax fieldDecl = (FieldDeclarationSyntax)ParseMember(string.Format("private _fieldType_ {0};", property.BackingFieldName));

            return(fieldDecl.ReplaceNode(fieldDecl.Declaration.Type, type).WithAdditionalAnnotations(Formatter.Annotation));
        }