Пример #1
0
        public void VisitObjectCreationExpression(ObjectCreationExpressionSyntax node)
        {
            if (node == null)
                throw new ArgumentNullException("node");

            node.Validate();

            ExpressionStart(node);

            if (_writer.Configuration.Other.AlignMultiLineConstructs.ArrayObjectCollectionInitializer)
                _writer.SetAlignmentBreak(true);

            _writer.WriteKeyword(PrinterKeyword.New);
            _writer.WriteSpace();
            node.Type.Accept(this);

            if (node.ArgumentList != null)
                node.ArgumentList.Accept(this);

            if (node.Initializer != null)
            {
                _writer.PushBraceFormatting(_writer.Configuration.BracesLayout.ArrayAndObjectInitializer, false);

                node.Initializer.Accept(this);

                _writer.PopBraceFormatting();

                if (_writer.Configuration.Other.AlignMultiLineConstructs.ArrayObjectCollectionInitializer)
                    _writer.SetAlignmentBreak(false);
            }

            ExpressionEnd(node);
        }