示例#1
0
        internal EnvDTE.CodeAttribute AddAttribute(
            SyntaxNode containerNode,
            string name,
            string value,
            object position,
            string target = null
            )
        {
            containerNode = CodeModelService.GetNodeWithAttributes(containerNode);
            var attributeNode = CodeModelService.CreateAttributeNode(
                CodeModelService.GetUnescapedName(name),
                value,
                target
                );
            var insertionIndex = CodeModelService.PositionVariantToAttributeInsertionIndex(
                position,
                containerNode,
                fileCodeModel: this
                );

            var newNode = InsertAttribute(containerNode, attributeNode, insertionIndex);

            return((EnvDTE.CodeAttribute)CodeModelService.CreateInternalCodeElement(
                       this.State,
                       fileCodeModel: this,
                       node: newNode
                       ));
        }