System.Xml.Serialization.XmlSerializationWriter.WriteAttribute C# (CSharp) Method

WriteAttribute() protected method

protected WriteAttribute ( string localName, string ns, string value ) : void
localName string
ns string
value string
return void
        protected void WriteAttribute(string localName, string ns, string value)
        {
            if (value == null) return;
            if (localName == "xmlns" || localName.StartsWith("xmlns:", StringComparison.Ordinal))
            {
                ;
            }
            else
            {
                int colon = localName.IndexOf(':');
                if (colon < 0)
                {
                    if (ns == XmlReservedNs.NsXml)
                    {
                        string prefix = _w.LookupPrefix(ns);
                        if (prefix == null || prefix.Length == 0)
                            prefix = "xml";
                        _w.WriteAttributeString(prefix, localName, ns, value);
                    }
                    else
                    {
                        _w.WriteAttributeString(localName, ns, value);
                    }
                }
                else
                {
                    string prefix = localName.Substring(0, colon);
                    _w.WriteAttributeString(prefix, localName.Substring(colon + 1), ns, value);
                }
            }
        }

Same methods

XmlSerializationWriter::WriteAttribute ( string localName, byte value ) : void
XmlSerializationWriter::WriteAttribute ( string localName, string value ) : void
XmlSerializationWriter::WriteAttribute ( string localName, string ns, byte value ) : void
XmlSerializationWriter::WriteAttribute ( string prefix, string localName, string ns, string value ) : void