示例#1
0
        public void VisitDelegateDeclaration(DelegateDeclarationSyntax node)
        {
            if (node == null)
                throw new ArgumentNullException("node");

            node.Validate();

            WriteLeadingTrivia(node);

            _writer.WriteIndent();

            WriteAttributes(
                node,
                _writer.Configuration.LineBreaksAndWrapping.Other.PlaceMethodAttributeOnSameLine
            );

            var modifiers = GetGlobalMemberModifiers(node, node.Modifiers);

            if (modifiers != Modifiers.None)
            {
                _writer.WriteModifiers(modifiers);
                _writer.WriteSpace();
            }

            _writer.WriteKeyword(PrinterKeyword.Delegate);
            _writer.WriteSpace();
            node.ReturnType.Accept(this);
            _writer.WriteSpace();
            _writer.WriteIdentifier(node.Identifier);

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

            node.ParameterList.Accept(this);

            if (node.ConstraintClauses.Count > 0)
                WriteConstraintClauses(node.ConstraintClauses);

            _writer.EndStatement();

            WriteTrailingTrivia(node);
        }