protected override XmlDictionaryWriter TakeXmlWriter(Stream stream) { if (_messageEncoder._optimizeWriteForUTF8) { return(XmlDictionaryWriter.CreateTextWriter(stream, _messageEncoder._writeEncoding, false)); } else { return(_messageEncoder.CreateWriter(stream)); } }
protected override XmlDictionaryWriter TakeXmlWriter(Stream stream) { if (messageEncoder.optimizeWriteForUTF8) { XmlDictionaryWriter returnedWriter = writer; if (returnedWriter == null) { returnedWriter = XmlDictionaryWriter.CreateTextWriter(stream, messageEncoder.writeEncoding, false); } else { writer = null; ((IXmlTextWriterInitializer)returnedWriter).SetOutput(stream, messageEncoder.writeEncoding, false); } return(returnedWriter); } else { return(messageEncoder.CreateWriter(stream)); } }