NArrange.CSharp.CSharpWriteVisitor.VisitAttributeElement C# (CSharp) Method

VisitAttributeElement() public method

Processes an attribute element.
public VisitAttributeElement ( AttributeElement element ) : void
element NArrange.Core.CodeElements.AttributeElement Attribute code element.
return void
        public override void VisitAttributeElement(AttributeElement element)
        {
            this.WriteComments(element.HeaderComments);

            bool nested = element.Parent is AttributeElement;

            if (!nested)
            {
                WriteIndented(CSharpSymbol.BeginAttribute.ToString());
                if (!string.IsNullOrEmpty(element.Target))
                {
                    Writer.Write(element.Target);
                    Writer.Write(CSharpSymbol.TypeImplements);
                    Writer.Write(' ');
                }
            }

            Writer.Write(element.Name);
            if (!string.IsNullOrEmpty(element.BodyText))
            {
                Writer.Write(CSharpSymbol.BeginParameterList);
                Writer.Write(element.BodyText);
                Writer.Write(CSharpSymbol.EndParameterList);
            }

            //
            // Nested list of attributes?
            //
            foreach (ICodeElement childElement in element.Children)
            {
                AttributeElement childAttribute = childElement as AttributeElement;
                if (childAttribute != null)
                {
                    Writer.Write(',');
                    Writer.WriteLine();
                    WriteIndented(string.Empty);
                    childAttribute.Accept(this);
                }
            }

            if (!nested)
            {
                Writer.Write(CSharpSymbol.EndAttribute);
            }

            if (!nested && element.Parent != null)
            {
                Writer.WriteLine();
            }
        }