public long WriteHeader(XmlWriter writer, BrokeredMessage brokeredMessage, SerializationTarget serializationTarget) { long num; using (BufferListStream bufferListStream = BufferListStream.Create(brokeredMessage.RawHeaderStream, 512)) { using (AmqpMessage amqpMessage = AmqpMessage.CreateAmqpStreamMessageHeader(bufferListStream)) { AmqpMessageEncoder.UpdateAmqpMessageHeadersAndProperties(brokeredMessage, amqpMessage, serializationTarget); if (serializationTarget == SerializationTarget.Communication) { writer.WriteStartElement("MessageHeaders"); } long num1 = amqpMessage.Write(writer); if (serializationTarget == SerializationTarget.Communication) { writer.WriteEndElement(); } num = num1; } } return(num); }