System.Xml.XmlTextWriter.WriteChars C# (CSharp) Method

WriteChars() public method

public WriteChars ( Char buffer, int index, int count ) : void
buffer Char
index int
count int
return void
        public override void WriteChars(Char[] buffer, int index, int count) {
            try {
                AutoComplete(Token.Content);
                xmlEncoder.Write(buffer, index, count);
            }
            catch {
                currentState = State.Error;
                throw;
            }
        }

Usage Example

Example #1
0
		/// <summary>
		/// Converts the object passed in to its XML representation.
		/// The XML string is written on the XmlTextWriter.
		/// </summary>
		public void ToXml(object value, FieldInfo field, XmlTextWriter xml, IMarshalContext context)
		{
			Type type = value.GetType();

			if ( value is char[] )
			{
				char[] buffer = value as char[];

				context.WriteStartTag( __arrayType, field, xml );
				xml.WriteChars( buffer, 0, buffer.Length );
				context.WriteEndTag( __arrayType, field, xml );
			}
			else
			{
				context.WriteStartTag( __type, field, xml );
				xml.WriteString( value.ToString() );
				context.WriteEndTag( __type, field, xml );
			}
		}