System.Xml.XmlBaseWriter.WriteProcessingInstruction C# (CSharp) Méthode

WriteProcessingInstruction() public méthode

public WriteProcessingInstruction ( string name, string text ) : void
name string
text string
Résultat void
        public override void WriteProcessingInstruction(string name, string text)
        {
            if (IsClosed)
                ThrowClosed();

            if (name != "xml")
                throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.Format(SR.XmlProcessingInstructionNotSupported), nameof(name)));

            if (_writeState != WriteState.Start)
                throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(SR.XmlInvalidDeclaration)));

            // The only thing the text can legitimately contain is version, encoding, and standalone.
            // We only support version 1.0, we can only write whatever encoding we were supplied, 
            // and we don't support DTDs, so whatever values are supplied in the text argument are irrelevant.
            _writer.WriteDeclaration();
        }