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

WriteEndElement() public method

public WriteEndElement ( ) : void
return void
		public override void WriteEndElement ()
		{
			CheckState ();

			if (state == WriteState.Attribute)
				throw new XmlException ("Cannot end element when an attribute is being written");
			if (state == WriteState.Element)
				CloseStartElement ();

			if (element_kinds.Count == 0)
				throw new XmlException ("There is no open element to close");
			switch (element_kinds.Pop ()) {
			case ElementType.String:
				if (!is_null) {
					if (no_string_yet)
						OutputAsciiChar ('"');
					OutputAsciiChar ('"');
				}
				no_string_yet = true;
				is_null = false;
				break;
			case ElementType.Array:
				OutputAsciiChar (']');
				break;
			case ElementType.Object:
				OutputAsciiChar ('}');
				break;
			}

			// not sure if it is correct though ...
			state = WriteState.Content;
			first_content_flags.Pop ();
		}