private void Write124_ServiceDescription(string n, string ns, ServiceDescription o, bool isNullable, bool needType)
 {
     if (o == null)
     {
         if (isNullable)
         {
             base.WriteNullTagLiteral(n, ns);
         }
     }
     else
     {
         if (!needType && !(o.GetType() == typeof(ServiceDescription)))
         {
             throw base.CreateUnknownTypeException(o);
         }
         base.WriteStartElement(n, ns, o, false, o.Namespaces);
         if (needType)
         {
             base.WriteXsiType("ServiceDescription", "http://schemas.xmlsoap.org/wsdl/");
         }
         XmlAttribute[] extensibleAttributes = o.ExtensibleAttributes;
         if (extensibleAttributes != null)
         {
             for (int i = 0; i < extensibleAttributes.Length; i++)
             {
                 XmlAttribute node = extensibleAttributes[i];
                 base.WriteXmlAttribute(node, o);
             }
         }
         base.WriteAttribute("name", "", o.Name);
         base.WriteAttribute("targetNamespace", "", o.TargetNamespace);
         if ((o.DocumentationElement == null) && (o.DocumentationElement != null))
         {
             throw base.CreateInvalidAnyTypeException(o.DocumentationElement);
         }
         base.WriteElementLiteral(o.DocumentationElement, "documentation", "http://schemas.xmlsoap.org/wsdl/", false, true);
         ServiceDescriptionFormatExtensionCollection extensions = o.Extensions;
         if (extensions != null)
         {
             for (int j = 0; j < extensions.Count; j++)
             {
                 if (!(extensions[j] is XmlNode) && (extensions[j] != null))
                 {
                     throw base.CreateInvalidAnyTypeException(extensions[j]);
                 }
                 base.WriteElementLiteral((XmlNode) extensions[j], "", null, false, true);
             }
         }
         ImportCollection imports = o.Imports;
         if (imports != null)
         {
             for (int k = 0; k < imports.Count; k++)
             {
                 this.Write4_Import("import", "http://schemas.xmlsoap.org/wsdl/", imports[k], false, false);
             }
         }
         this.Write67_Types("types", "http://schemas.xmlsoap.org/wsdl/", o.Types, false, false);
         MessageCollection messages = o.Messages;
         if (messages != null)
         {
             for (int m = 0; m < messages.Count; m++)
             {
                 this.Write69_Message("message", "http://schemas.xmlsoap.org/wsdl/", messages[m], false, false);
             }
         }
         PortTypeCollection portTypes = o.PortTypes;
         if (portTypes != null)
         {
             for (int num5 = 0; num5 < portTypes.Count; num5++)
             {
                 this.Write75_PortType("portType", "http://schemas.xmlsoap.org/wsdl/", portTypes[num5], false, false);
             }
         }
         BindingCollection bindings = o.Bindings;
         if (bindings != null)
         {
             for (int num6 = 0; num6 < bindings.Count; num6++)
             {
                 this.Write117_Binding("binding", "http://schemas.xmlsoap.org/wsdl/", bindings[num6], false, false);
             }
         }
         ServiceCollection services = o.Services;
         if (services != null)
         {
             for (int num7 = 0; num7 < services.Count; num7++)
             {
                 this.Write123_Service("service", "http://schemas.xmlsoap.org/wsdl/", services[num7], false, false);
             }
         }
         base.WriteEndElement(o);
     }
 }