Type Reason ArgumentNullException buffer is null. ArgumentException The buffer length minus index is less than count. ArgumentOutOfRangeException index or count is less than zero. InvalidOperationException The XmlWriter.WriteState is WriteState.Closed.
This method can be used to write large amounts of text one buffer at a time.
Special handling must be done to ensure the WriteChars method does not split surrogate pair characters across multiple buffer writes. The XML specification defines the valid ranges for surrogate pairs.
For the asynchronous version of this method, see XmlWriter.WriteCharsAsync(Char[], int, int).