XmlDictionary dict = new XmlDictionary(); XmlDictionaryString elementName = dict.Add("myElement");
XmlDictionary dict = new XmlDictionary(); XmlDictionaryString elementName = dict.Add("myElement"); XmlWriterSettings settings = new XmlWriterSettings(); settings.OmitXmlDeclaration = true; MemoryStream stream = new MemoryStream(); using(XmlWriter writer = XmlWriter.Create(stream, settings)) { writer.WriteStartElement(elementName); writer.WriteEndElement(); } string output = Encoding.UTF8.GetString(stream.ToArray());In this example, an XmlDictionary is created and a XmlDictionaryString named "elementName" is added to it, with a value of "myElement". An XmlWriter is then used to create an XML element using the XmlDictionaryString as the element name. The resulting output is a string of the XML element without an XML declaration. Package Library: System.Xml.dll