System.Runtime.Serialization.Json.JsonWriter.WriteWhitespace C# (CSharp) Method

WriteWhitespace() public method

public WriteWhitespace ( string text ) : void
text string
return void
		public override void WriteWhitespace (string text)
		{
			if (text == null)
				throw new ArgumentNullException ("text");
			for (int i = 0; i < text.Length; i++) {
				if (text [i] != ' ') {
					for (int j = i; j < text.Length; j++) {
						switch (text [j]) {
						case '\t':
						case ' ':
						case '\n':
						case '\r':
							continue;
						default:
							throw new ArgumentException (String.Format ("WriteWhitespace() does not accept non-whitespace character '{0}'", text [j]));
						}
					}
					break;
				}
			}
			WriteString (text);
		}