void Write26_IssueCollectionType(string n, string ns, global::Xbim.COBieLite.IssueCollectionType o, bool isNullable, bool needType) {
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::Xbim.COBieLite.IssueCollectionType)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(@"IssueCollectionType", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core");
     {
         global::System.Collections.Generic.List<global::Xbim.COBieLite.IssueType> a = (global::System.Collections.Generic.List<global::Xbim.COBieLite.IssueType>)o.@Issue;
         if (a != null) {
             for (int ia = 0; ia < ((System.Collections.ICollection)a).Count; ia++) {
                 Write25_IssueType(@"Issue", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core", ((global::Xbim.COBieLite.IssueType)a[ia]), false, false);
             }
         }
     }
     WriteEndElement(o);
 }
 void Write8_DataSvcMapFileImpl(string n, string ns, global::System.Web.Compilation.WCFModel.DataSvcMapFileImpl o, bool isNullable, bool needType) {
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::System.Web.Compilation.WCFModel.DataSvcMapFileImpl)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(@"DataSvcMapFileImpl", @"urn:schemas-microsoft-com:xml-dataservicemap");
     WriteAttribute(@"ID", @"", ((global::System.String)o.@ID));
     {
         global::System.Collections.Generic.List<global::System.Web.Compilation.WCFModel.MetadataSource> a = (global::System.Collections.Generic.List<global::System.Web.Compilation.WCFModel.MetadataSource>)((global::System.Collections.Generic.List<global::System.Web.Compilation.WCFModel.MetadataSource>)o.@MetadataSourceList);
         if (a != null){
             WriteStartElement(@"MetadataSources", @"urn:schemas-microsoft-com:xml-dataservicemap", null, false);
             for (int ia = 0; ia < ((System.Collections.ICollection)a).Count; ia++) {
                 Write2_MetadataSource(@"MetadataSource", @"urn:schemas-microsoft-com:xml-dataservicemap", ((global::System.Web.Compilation.WCFModel.MetadataSource)a[ia]), true, false);
             }
             WriteEndElement();
         }
     }
     {
         global::System.Collections.Generic.List<global::System.Web.Compilation.WCFModel.MetadataFile> a = (global::System.Collections.Generic.List<global::System.Web.Compilation.WCFModel.MetadataFile>)((global::System.Collections.Generic.List<global::System.Web.Compilation.WCFModel.MetadataFile>)o.@MetadataList);
         if (a != null){
             WriteStartElement(@"Metadata", @"urn:schemas-microsoft-com:xml-dataservicemap", null, false);
             for (int ia = 0; ia < ((System.Collections.ICollection)a).Count; ia++) {
                 Write5_MetadataFile(@"MetadataFile", @"urn:schemas-microsoft-com:xml-dataservicemap", ((global::System.Web.Compilation.WCFModel.MetadataFile)a[ia]), true, false);
             }
             WriteEndElement();
         }
     }
     {
         global::System.Collections.Generic.List<global::System.Web.Compilation.WCFModel.ExtensionFile> a = (global::System.Collections.Generic.List<global::System.Web.Compilation.WCFModel.ExtensionFile>)((global::System.Collections.Generic.List<global::System.Web.Compilation.WCFModel.ExtensionFile>)o.@Extensions);
         if (a != null){
             WriteStartElement(@"Extensions", @"urn:schemas-microsoft-com:xml-dataservicemap", null, false);
             for (int ia = 0; ia < ((System.Collections.ICollection)a).Count; ia++) {
                 Write6_ExtensionFile(@"ExtensionFile", @"urn:schemas-microsoft-com:xml-dataservicemap", ((global::System.Web.Compilation.WCFModel.ExtensionFile)a[ia]), true, false);
             }
             WriteEndElement();
         }
     }
     {
         global::System.Collections.Generic.List<global::System.Web.Compilation.WCFModel.Parameter> a = (global::System.Collections.Generic.List<global::System.Web.Compilation.WCFModel.Parameter>)((global::System.Collections.Generic.List<global::System.Web.Compilation.WCFModel.Parameter>)o.@Parameters);
         if (a != null){
             WriteStartElement(@"Parameters", @"urn:schemas-microsoft-com:xml-dataservicemap", null, false);
             for (int ia = 0; ia < ((System.Collections.ICollection)a).Count; ia++) {
                 Write7_Parameter(@"Parameter", @"urn:schemas-microsoft-com:xml-dataservicemap", ((global::System.Web.Compilation.WCFModel.Parameter)a[ia]), true, false);
             }
             WriteEndElement();
         }
     }
     WriteEndElement(o);
 }
 void Write95_FacilityType(string n, string ns, global::Xbim.COBieLite.FacilityType o, bool isNullable, bool needType) {
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::Xbim.COBieLite.FacilityType)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(@"FacilityTypeBase", @"http://docs.buildingsmartalliance.org/nbims03/cobie/cobielite");
     WriteAttribute(@"externalEntityName", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core", ((global::System.String)o.@externalEntityName));
     WriteAttribute(@"externalID", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core", ((global::System.String)o.@externalID));
     WriteAttribute(@"externalSystemName", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core", ((global::System.String)o.@externalSystemName));
     WriteElementString(@"FacilityName", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core", ((global::System.String)o.@FacilityName));
     WriteElementString(@"FacilityCategory", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core", ((global::System.String)o.@FacilityCategory));
     Write87_ProjectType(@"ProjectAssignment", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core", ((global::Xbim.COBieLite.ProjectType)o.@ProjectAssignment), false, false);
     Write86_SiteType(@"SiteAssignment", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core", ((global::Xbim.COBieLite.SiteType)o.@SiteAssignment), false, false);
     if (o.@FacilityDefaultLinearUnitSpecified) {
         WriteElementString(@"FacilityDefaultLinearUnit", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core", Write92_LinearUnitSimpleType(((global::Xbim.COBieLite.LinearUnitSimpleType)o.@FacilityDefaultLinearUnit)));
     }
     if (o.@FacilityDefaultAreaUnitSpecified) {
         WriteElementString(@"FacilityDefaultAreaUnit", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core", Write93_AreaUnitSimpleType(((global::Xbim.COBieLite.AreaUnitSimpleType)o.@FacilityDefaultAreaUnit)));
     }
     if (o.@FacilityDefaultVolumeUnitSpecified) {
         WriteElementString(@"FacilityDefaultVolumeUnit", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core", Write94_VolumeUnitSimpleType(((global::Xbim.COBieLite.VolumeUnitSimpleType)o.@FacilityDefaultVolumeUnit)));
     }
     if (o.@FacilityDefaultCurrencyUnitSpecified) {
         WriteElementString(@"FacilityDefaultCurrencyUnit", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core", Write75_CurrencyUnitSimpleType(((global::Xbim.COBieLite.CurrencyUnitSimpleType)o.@FacilityDefaultCurrencyUnit)));
     }
     WriteElementString(@"FacilityDefaultMeasurementStandard", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core", ((global::System.String)o.@FacilityDefaultMeasurementStandard));
     WriteElementString(@"FacilityDescription", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core", ((global::System.String)o.@FacilityDescription));
     WriteElementString(@"FacilityDeliverablePhaseName", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core", ((global::System.String)o.@FacilityDeliverablePhaseName));
     Write65_FloorCollectionType(@"Floors", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core", ((global::Xbim.COBieLite.FloorCollectionType)o.@Floors), false, false);
     Write55_ZoneCollectionType(@"Zones", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core", ((global::Xbim.COBieLite.ZoneCollectionType)o.@Zones), false, false);
     Write52_AssetTypeCollectionType(@"AssetTypes", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core", ((global::Xbim.COBieLite.AssetTypeCollectionType)o.@AssetTypes), false, false);
     Write58_SystemCollectionType(@"Systems", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core", ((global::Xbim.COBieLite.SystemCollectionType)o.@Systems), false, false);
     Write71_ConnectionCollectionType(@"Connections", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core", ((global::Xbim.COBieLite.ConnectionCollectionType)o.@Connections), false, false);
     Write68_ContactCollectionType(@"Contacts", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core", ((global::Xbim.COBieLite.ContactCollectionType)o.@Contacts), false, false);
     Write79_AttributeCollectionType(@"FacilityAttributes", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core", ((global::Xbim.COBieLite.AttributeCollectionType)o.@FacilityAttributes), false, false);
     Write28_DocumentCollectionType(@"FacilityDocuments", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core", ((global::Xbim.COBieLite.DocumentCollectionType)o.@FacilityDocuments), false, false);
     Write26_IssueCollectionType(@"FacilityIssues", @"http://docs.buildingsmartalliance.org/nbims03/cobie/core", ((global::Xbim.COBieLite.IssueCollectionType)o.@FacilityIssues), false, false);
     WriteEndElement(o);
 }
 void Write3_DiscoveryDocumentReference(string n, string ns, global::System.Web.Services.Discovery.DiscoveryDocumentReference o, bool isNullable, bool needType) {
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::System.Web.Services.Discovery.DiscoveryDocumentReference)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(@"DiscoveryDocumentReference", @"http://schemas.xmlsoap.org/disco/");
     WriteAttribute(@"ref", @"", ((global::System.String)o.@Ref));
     WriteEndElement(o);
 }
 void Write1_Object(string n, string ns, global::System.Object o, bool isNullable, bool needType, string parentRuntimeNs = null, string parentCompileTimeNs = null) {
     string defaultNamespace = parentRuntimeNs;
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::System.Object)) {
         }
         else {
             WriteTypedPrimitive(n, ns, o, true);
             return;
         }
     }
     WriteStartElement(n, ns, o, false, null);
     WriteEndElement(o);
 }
 void Write9_DiscoveryDocument(string n, string ns, global::System.Web.Services.Discovery.DiscoveryDocument o, bool isNullable, bool needType) {
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::System.Web.Services.Discovery.DiscoveryDocument)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(@"DiscoveryDocument", @"http://schemas.xmlsoap.org/disco/");
     {
         global::System.Collections.IList a = (global::System.Collections.IList)o.@References;
         if (a != null) {
             for (int ia = 0; ia < ((System.Collections.ICollection)a).Count; ia++) {
                 global::System.Object ai = (global::System.Object)a[ia];
                 {
                     if (ai is global::System.Web.Services.Discovery.SchemaReference) {
                         Write7_SchemaReference(@"schemaRef", @"http://schemas.xmlsoap.org/disco/schema/", ((global::System.Web.Services.Discovery.SchemaReference)ai), false, false);
                     }
                     else if (ai is global::System.Web.Services.Discovery.ContractReference) {
                         Write5_ContractReference(@"contractRef", @"http://schemas.xmlsoap.org/disco/scl/", ((global::System.Web.Services.Discovery.ContractReference)ai), false, false);
                     }
                     else if (ai is global::System.Web.Services.Discovery.DiscoveryDocumentReference) {
                         Write3_DiscoveryDocumentReference(@"discoveryRef", @"http://schemas.xmlsoap.org/disco/", ((global::System.Web.Services.Discovery.DiscoveryDocumentReference)ai), false, false);
                     }
                     else if (ai is global::System.Web.Services.Discovery.SoapBinding) {
                         Write8_SoapBinding(@"soap", @"http://schemas.xmlsoap.org/disco/soap/", ((global::System.Web.Services.Discovery.SoapBinding)ai), false, false);
                     }
                     else {
                         if (ai != null) {
                             throw CreateUnknownTypeException(ai);
                         }
                     }
                 }
             }
         }
     }
     WriteEndElement(o);
 }
 void Write8_SoapBinding(string n, string ns, global::System.Web.Services.Discovery.SoapBinding o, bool isNullable, bool needType) {
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::System.Web.Services.Discovery.SoapBinding)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(@"SoapBinding", @"http://schemas.xmlsoap.org/disco/soap/");
     WriteAttribute(@"address", @"", ((global::System.String)o.@Address));
     WriteAttribute(@"binding", @"", FromXmlQualifiedName(((global::System.Xml.XmlQualifiedName)o.@Binding)));
     WriteEndElement(o);
 }
 void Write14_ExtensionFile(string n, string ns, global::System.Web.Compilation.WCFModel.ExtensionFile o, bool isNullable, bool needType) {
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::System.Web.Compilation.WCFModel.ExtensionFile)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(@"ExtensionFile", @"urn:schemas-microsoft-com:xml-wcfservicemap");
     WriteAttribute(@"FileName", @"", ((global::System.String)o.@FileName));
     WriteAttribute(@"Name", @"", ((global::System.String)o.@Name));
     WriteEndElement(o);
 }
 void Write11_PdbxFile(string n, string ns, global::Microsoft.SPOT.Debugger.Pdbx.PdbxFile o, bool isNullable, bool needType)
 {
     if ((object)o == null)
     {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType)
     {
         System.Type t = o.GetType();
         if (t == typeof(global::Microsoft.SPOT.Debugger.Pdbx.PdbxFile))
         {
         }
         else
         {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(@"PdbxFile", @"");
     Write10_Assembly(@"Assembly", @"", ((global::Microsoft.SPOT.Debugger.Pdbx.Assembly)o.@Assembly), false, false);
     WriteEndElement(o);
 }
 void Write10_Assembly(string n, string ns, global::Microsoft.SPOT.Debugger.Pdbx.Assembly o, bool isNullable, bool needType)
 {
     if ((object)o == null)
     {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType)
     {
         System.Type t = o.GetType();
         if (t == typeof(global::Microsoft.SPOT.Debugger.Pdbx.Assembly))
         {
         }
         else
         {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(@"Assembly", @"");
     WriteElementString(@"FileName", @"", ((global::System.String)o.@FileName));
     Write2_VersionStruct(@"Version", @"", ((global::Microsoft.SPOT.Debugger.Pdbx.Assembly.VersionStruct)o.@Version), false);
     Write4_Token(@"Token", @"", ((global::Microsoft.SPOT.Debugger.Pdbx.Token)o.@Token), false, false);
     {
         global::Microsoft.SPOT.Debugger.Pdbx.Class[] a = (global::Microsoft.SPOT.Debugger.Pdbx.Class[])((global::Microsoft.SPOT.Debugger.Pdbx.Class[])o.@Classes);
         if (a != null)
         {
             WriteStartElement(@"Classes", @"", null, false);
             for (int ia = 0; ia < a.Length; ia++)
             {
                 Write9_Class(@"Class", @"", ((global::Microsoft.SPOT.Debugger.Pdbx.Class)a[ia]), true, false);
             }
             WriteEndElement();
         }
     }
     WriteEndElement(o);
 }
 void Write1_Object(string n, string ns, global::System.Object o, bool isNullable, bool needType, string parentRuntimeNs = null, string parentCompileTimeNs = null) {
     string defaultNamespace = parentRuntimeNs;
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::System.Object)) {
         }
         else if (t == typeof(global::NavigationMenuSample.Models.PersistModel)) {
             Write2_PersistModel(n, ns,(global::NavigationMenuSample.Models.PersistModel)o, isNullable, true);
             return;
         }
         else if (t == typeof(global::System.Collections.Generic.List<global::NavigationMenuSample.Models.PersistModel>)) {
             Writer.WriteStartElement(n, ns);
             WriteXsiType(@"ArrayOfPersistModel", @"");
             {
                 global::System.Collections.Generic.List<global::NavigationMenuSample.Models.PersistModel> a = (global::System.Collections.Generic.List<global::NavigationMenuSample.Models.PersistModel>)o;
                 if (a != null) {
                     for (int ia = 0; ia < ((System.Collections.ICollection)a).Count; ia++) {
                         string namespace5 = ( parentCompileTimeNs == @"" && parentRuntimeNs != null ) ? parentRuntimeNs : @"";
                         Write2_PersistModel(@"PersistModel", namespace5, ((global::NavigationMenuSample.Models.PersistModel)a[ia]), true, false, namespace5, @"");
                     }
                 }
             }
             Writer.WriteEndElement();
             return;
         }
         else {
             WriteTypedPrimitive(n, ns, o, true);
             return;
         }
     }
     WriteStartElement(n, ns, o, false, null);
     WriteEndElement(o);
 }
 void Write2_SEvent(string n, string ns, global::RaspberryPi.SEvent o, bool isNullable, bool needType, string parentRuntimeNs = null, string parentCompileTimeNs = null) {
     string defaultNamespace = parentRuntimeNs;
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::RaspberryPi.SEvent)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(@"SEvent", defaultNamespace);
     string namespace3 = ( parentCompileTimeNs == @"" && parentRuntimeNs != null ) ? parentRuntimeNs : @"";
     WriteElementStringRaw(@"Day", namespace3, System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)o.@Day)));
     string namespace4 = ( parentCompileTimeNs == @"" && parentRuntimeNs != null ) ? parentRuntimeNs : @"";
     WriteElementStringRaw(@"hour", namespace4, System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)o.@hour)));
     string namespace5 = ( parentCompileTimeNs == @"" && parentRuntimeNs != null ) ? parentRuntimeNs : @"";
     WriteElementStringRaw(@"minutes", namespace5, System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)o.@minutes)));
     WriteEndElement(o);
 }
 void Write5_GeneratedClass(string n, string ns, global::Generator.GeneratedClass o, bool isNullable, bool needType)
 {
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::Generator.GeneratedClass)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(@"GeneratedClass", @"");
     WriteAttribute(@"name", @"", ((global::System.String)o.@Name));
     WriteAttribute(@"comment", @"", ((global::System.String)o.@Comment));
     WriteAttribute(@"parent", @"", ((global::System.String)o.@Parent));
     {
         global::Generator.Field[] a = (global::Generator.Field[])o.@Fields;
         if (a != null) {
             for (int ia = 0; ia < a.Length; ia++) {
                 Write3_Field(@"Field", @"", ((global::Generator.Field)a[ia]), false, false);
             }
         }
     }
     {
         global::Generator.Method[] a = (global::Generator.Method[])o.@Methods;
         if (a != null) {
             for (int ia = 0; ia < a.Length; ia++) {
                 Write4_Method(@"Method", @"", ((global::Generator.Method)a[ia]), false, false);
             }
         }
     }
     WriteEndElement(o);
 }
        void Write66_MetadataSection(string n, string ns, global::System.ServiceModel.Description.MetadataSection o, bool isNullable, bool needType)
        {
            if ((object)o == null)
            {
                if (isNullable) WriteNullTagLiteral(n, ns);
                return;
            }
            if (!needType)
            {
                System.Type t = o.GetType();
                if (t == typeof(global::System.ServiceModel.Description.MetadataSection))
                {
                }
                else
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(CreateUnknownTypeException(o));
                }
            }


            XmlSerializerNamespaces xmlSerializerNamespaces = new XmlSerializerNamespaces();
            xmlSerializerNamespaces.Add(string.Empty, string.Empty);

            WriteStartElement(n, ns, o, true, xmlSerializerNamespaces);
            if (needType) WriteXsiType(@"MetadataSection", @"http://schemas.xmlsoap.org/ws/2004/09/mex");
            {
                global::System.Collections.ObjectModel.Collection<global::System.Xml.XmlAttribute> a = (global::System.Collections.ObjectModel.Collection<global::System.Xml.XmlAttribute>)o.@Attributes;
                if (a != null)
                {
                    for (int i = 0; i < ((System.Collections.ICollection)a).Count; i++)
                    {
                        global::System.Xml.XmlAttribute ai = (global::System.Xml.XmlAttribute)a[i];
                        WriteXmlAttribute(ai, o);
                    }
                }
            }
            WriteAttribute(@"Dialect", @"", ((global::System.String)o.@Dialect));
            WriteAttribute(@"Identifier", @"", ((global::System.String)o.@Identifier));
            {
                if (o.@Metadata is global::System.Web.Services.Description.ServiceDescription)
                {
                    ((global::System.Web.Services.Description.ServiceDescription)o.@Metadata).Write(this.Writer);
                }
                else if (o.@Metadata is global::System.Xml.Schema.XmlSchema)
                {
                    ((global::System.Xml.Schema.XmlSchema)o.@Metadata).Write(this.Writer);
                }
                else if (o.@Metadata is global::System.ServiceModel.Description.MetadataSet)
                {
                    Write67_MetadataSet(@"Metadata", @"http://schemas.xmlsoap.org/ws/2004/09/mex", ((global::System.ServiceModel.Description.MetadataSet)o.@Metadata), false, false);
                }
                else if (o.@Metadata is global::System.ServiceModel.Description.MetadataLocation)
                {
                    Write65_MetadataLocation(@"Location", @"http://schemas.xmlsoap.org/ws/2004/09/mex", ((global::System.ServiceModel.Description.MetadataLocation)o.@Metadata), false, false);
                }
                else if (o.@Metadata is global::System.ServiceModel.Description.MetadataReference)
                {
                    WriteSerializable((System.Xml.Serialization.IXmlSerializable)((global::System.ServiceModel.Description.MetadataReference)o.@Metadata), @"MetadataReference", @"http://schemas.xmlsoap.org/ws/2004/09/mex", false, true);
                }
                else if (o.@Metadata is System.Xml.XmlElement)
                {
                    System.Xml.XmlElement elem = (System.Xml.XmlElement)o.@Metadata;
                    if ((elem) is System.Xml.XmlNode || elem == null)
                    {
                        WriteElementLiteral((System.Xml.XmlNode)elem, @"", null, false, true);
                    }
                    else
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(CreateInvalidAnyTypeException(elem));
                    }
                }
                else
                {
                    if (o.@Metadata != null)
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(CreateUnknownTypeException(o.@Metadata));
                    }
                }
            }
            WriteEndElement(o);
        }
 void Write65_MetadataLocation(string n, string ns, global::System.ServiceModel.Description.MetadataLocation o, bool isNullable, bool needType)
 {
     if ((object)o == null)
     {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType)
     {
         System.Type t = o.GetType();
         if (t == typeof(global::System.ServiceModel.Description.MetadataLocation))
         {
         }
         else
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(CreateUnknownTypeException(o));
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(@"MetadataLocation", @"http://schemas.xmlsoap.org/ws/2004/09/mex");
     {
         WriteValue(((global::System.String)o.@Location));
     }
     WriteEndElement(o);
 }
 void Write52_Item(string n, string ns, global::Microsoft.Xml.Serialization.GeneratedAssembly.ReturnValueSerializerSerializerSerializerSerializer o, bool isNullable, bool needType)
 {
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::Microsoft.Xml.Serialization.GeneratedAssembly.ReturnValueSerializerSerializerSerializerSerializer)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(@"ReturnValueSerializerSerializerSerializerSerializer", @"");
     WriteEndElement(o);
 }
        void Write67_MetadataSet(string n, string ns, global::System.ServiceModel.Description.MetadataSet o, bool isNullable, bool needType)
        {
            if (processOuterElement)
            {
                if ((object)o == null)
                {
                    if (isNullable) WriteNullTagLiteral(n, ns);
                    return;
                }
            }
            if (!needType)
            {
                System.Type t = o.GetType();
                if (t == typeof(global::System.ServiceModel.Description.MetadataSet))
                {
                }
                else
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(CreateUnknownTypeException(o));
                }
            }
            if (processOuterElement)
            {
                WriteStartElement(n, ns, o, false, null);
            }

            XmlSerializerNamespaces xmlSerializerNamespaces = new XmlSerializerNamespaces();
            xmlSerializerNamespaces.Add(MetadataStrings.MetadataExchangeStrings.Prefix, MetadataStrings.MetadataExchangeStrings.Namespace);
            WriteNamespaceDeclarations(xmlSerializerNamespaces);

            if (needType) WriteXsiType(@"MetadataSet", @"http://schemas.xmlsoap.org/ws/2004/09/mex");
            {
                global::System.Collections.ObjectModel.Collection<global::System.Xml.XmlAttribute> a = (global::System.Collections.ObjectModel.Collection<global::System.Xml.XmlAttribute>)o.@Attributes;
                if (a != null)
                {
                    for (int i = 0; i < ((System.Collections.ICollection)a).Count; i++)
                    {
                        global::System.Xml.XmlAttribute ai = (global::System.Xml.XmlAttribute)a[i];
                        WriteXmlAttribute(ai, o);
                    }
                }
            }
            {
                global::System.Collections.ObjectModel.Collection<global::System.ServiceModel.Description.MetadataSection> a = (global::System.Collections.ObjectModel.Collection<global::System.ServiceModel.Description.MetadataSection>)o.@MetadataSections;
                if (a != null)
                {
                    for (int ia = 0; ia < ((System.Collections.ICollection)a).Count; ia++)
                    {
                        Write66_MetadataSection(@"MetadataSection", @"http://schemas.xmlsoap.org/ws/2004/09/mex", ((global::System.ServiceModel.Description.MetadataSection)a[ia]), false, false);
                    }
                }
            }
            if (processOuterElement)
            {
                WriteEndElement(o);
            }
        }
 void Write2_MetadataSource(string n, string ns, global::System.Web.Compilation.WCFModel.MetadataSource o, bool isNullable, bool needType) {
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::System.Web.Compilation.WCFModel.MetadataSource)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(@"MetadataSource", @"urn:schemas-microsoft-com:xml-dataservicemap");
     WriteAttribute(@"Address", @"", ((global::System.String)o.@Address));
     WriteAttribute(@"Protocol", @"", ((global::System.String)o.@Protocol));
     WriteAttribute(@"SourceId", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)o.@SourceId)));
     WriteEndElement(o);
 }
 void Write2_ExternalLibrary(string n, string ns, global::ExcelDna.Integration.ExternalLibrary o, bool isNullable, bool needType)
 {
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::ExcelDna.Integration.ExternalLibrary)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(null, @"");
     WriteAttribute(@"Path", @"", ((global::System.String)o.@Path));
     WriteAttribute(@"TypeLibPath", @"", ((global::System.String)o.@TypeLibPath));
     WriteAttribute(@"ComServer", @"", System.Xml.XmlConvert.ToString((global::System.Boolean)((global::System.Boolean)o.@ComServer)));
     WriteAttribute(@"Pack", @"", System.Xml.XmlConvert.ToString((global::System.Boolean)((global::System.Boolean)o.@Pack)));
     WriteAttribute(@"LoadFromBytes", @"", System.Xml.XmlConvert.ToString((global::System.Boolean)((global::System.Boolean)o.@LoadFromBytes)));
     WriteAttribute(@"ExplicitExports", @"", System.Xml.XmlConvert.ToString((global::System.Boolean)((global::System.Boolean)o.@ExplicitExports)));
     WriteEndElement(o);
 }
 void Write7_BaseLaunchOptions(string n, string ns, global::MICore.Xml.LaunchOptions.BaseLaunchOptions o, bool isNullable, bool needType) {
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::MICore.Xml.LaunchOptions.BaseLaunchOptions)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(@"BaseLaunchOptions", @"http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014");
     WriteAttribute(@"ExePath", @"", ((global::System.String)o.@ExePath));
     WriteAttribute(@"ExeArguments", @"", ((global::System.String)o.@ExeArguments));
     WriteAttribute(@"WorkingDirectory", @"", ((global::System.String)o.@WorkingDirectory));
     WriteAttribute(@"VisualizerFile", @"", ((global::System.String)o.@VisualizerFile));
     WriteAttribute(@"TargetArchitecture", @"", Write1_TargetArchitecture(((global::MICore.Xml.LaunchOptions.TargetArchitecture)o.@TargetArchitecture)));
     WriteAttribute(@"AdditionalSOLibSearchPath", @"", ((global::System.String)o.@AdditionalSOLibSearchPath));
     if (o.@MIModeSpecified) {
         WriteAttribute(@"MIMode", @"", Write2_MIMode(((global::MICore.Xml.LaunchOptions.MIMode)o.@MIMode)));
     }
     {
         global::MICore.Xml.LaunchOptions.Command[] a = (global::MICore.Xml.LaunchOptions.Command[])((global::MICore.Xml.LaunchOptions.Command[])o.@SetupCommands);
         if (a != null){
             WriteStartElement(@"SetupCommands", @"http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014", null, false);
             for (int ia = 0; ia < a.Length; ia++) {
                 Write5_Command(@"Command", @"http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014", ((global::MICore.Xml.LaunchOptions.Command)a[ia]), false, false);
             }
             WriteEndElement();
         }
     }
     {
         global::MICore.Xml.LaunchOptions.Command[] a = (global::MICore.Xml.LaunchOptions.Command[])((global::MICore.Xml.LaunchOptions.Command[])o.@CustomLaunchSetupCommands);
         if (a != null){
             WriteStartElement(@"CustomLaunchSetupCommands", @"http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014", null, false);
             for (int ia = 0; ia < a.Length; ia++) {
                 Write5_Command(@"Command", @"http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014", ((global::MICore.Xml.LaunchOptions.Command)a[ia]), false, false);
             }
             WriteEndElement();
         }
     }
     if (o.@LaunchCompleteCommandSpecified) {
         WriteElementString(@"LaunchCompleteCommand", @"http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014", Write6_Item(((global::MICore.Xml.LaunchOptions.BaseLaunchOptionsLaunchCompleteCommand)o.@LaunchCompleteCommand)));
     }
     if (o.@MIModeSpecified) {
     }
     WriteEndElement(o);
 }
 void Write5_Command(string n, string ns, global::MICore.Xml.LaunchOptions.Command o, bool isNullable, bool needType) {
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::MICore.Xml.LaunchOptions.Command)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(@"Command", @"http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014");
     if (o.@IgnoreFailuresSpecified) {
         WriteAttribute(@"IgnoreFailures", @"", System.Xml.XmlConvert.ToString((global::System.Boolean)((global::System.Boolean)o.@IgnoreFailures)));
     }
     WriteAttribute(@"Description", @"", ((global::System.String)o.@Description));
     if (o.@IgnoreFailuresSpecified) {
     }
     if ((object)(o.@Value) != null){
         WriteValue(((global::System.String)o.@Value));
     }
     WriteEndElement(o);
 }
 void Write6_Image(string n, string ns, global::ExcelDna.Integration.Image o, bool isNullable, bool needType)
 {
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::ExcelDna.Integration.Image)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(null, @"");
     WriteAttribute(@"Name", @"", ((global::System.String)o.@Name));
     WriteAttribute(@"Path", @"", ((global::System.String)o.@Path));
     WriteAttribute(@"Pack", @"", System.Xml.XmlConvert.ToString((global::System.Boolean)((global::System.Boolean)o.@Pack)));
     WriteEndElement(o);
 }
 void Write5_Project(string n, string ns, global::ExcelDna.Integration.Project o, bool isNullable, bool needType)
 {
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::ExcelDna.Integration.Project)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(null, @"");
     WriteAttribute(@"Name", @"", ((global::System.String)o.@Name));
     WriteAttribute(@"Language", @"", ((global::System.String)o.@Language));
     WriteAttribute(@"CompilerVersion", @"", ((global::System.String)o.@CompilerVersion));
     WriteAttribute(@"DefaultReferences", @"", System.Xml.XmlConvert.ToString((global::System.Boolean)((global::System.Boolean)o.@DefaultReferences)));
     WriteAttribute(@"DefaultImports", @"", System.Xml.XmlConvert.ToString((global::System.Boolean)((global::System.Boolean)o.@DefaultImports)));
     WriteAttribute(@"ExplicitExports", @"", System.Xml.XmlConvert.ToString((global::System.Boolean)((global::System.Boolean)o.@ExplicitExports)));
     WriteAttribute(@"ComServer", @"", System.Xml.XmlConvert.ToString((global::System.Boolean)((global::System.Boolean)o.@ComServer)));
     {
         global::System.Collections.Generic.List<global::ExcelDna.Integration.Reference> a = (global::System.Collections.Generic.List<global::ExcelDna.Integration.Reference>)o.@References;
         if (a != null) {
             for (int ia = 0; ia < ((System.Collections.ICollection)a).Count; ia++) {
                 Write3_Reference(@"Reference", @"", ((global::ExcelDna.Integration.Reference)a[ia]), false, false);
             }
         }
     }
     {
         global::System.Collections.Generic.List<global::ExcelDna.Integration.SourceItem> a = (global::System.Collections.Generic.List<global::ExcelDna.Integration.SourceItem>)o.@SourceItems;
         if (a != null) {
             for (int ia = 0; ia < ((System.Collections.ICollection)a).Count; ia++) {
                 Write4_SourceItem(@"SourceItem", @"", ((global::ExcelDna.Integration.SourceItem)a[ia]), false, false);
             }
         }
     }
     if ((object)(o.@Code) != null){
         WriteValue(((global::System.String)o.@Code));
     }
     WriteEndElement(o);
 }
 void Write7_ObjectModel(string n, string ns, global::Generator.ObjectModel o, bool isNullable, bool needType)
 {
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::Generator.ObjectModel)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(@"ObjectModel", @"");
     WriteAttribute(@"name", @"", ((global::System.String)o.@Name));
     {
         global::Generator.Package[] a = (global::Generator.Package[])o.@Packages;
         if (a != null) {
             for (int ia = 0; ia < a.Length; ia++) {
                 Write6_Package(@"Package", @"", ((global::Generator.Package)a[ia]), false, false);
             }
         }
     }
     WriteEndElement(o);
 }
 void Write7_DnaLibrary(string n, string ns, global::ExcelDna.Integration.DnaLibrary o, bool isNullable, bool needType)
 {
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::ExcelDna.Integration.DnaLibrary)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(null, @"");
     WriteAttribute(@"Name", @"", ((global::System.String)o.@Name));
     WriteAttribute(@"RuntimeVersion", @"", ((global::System.String)o.@RuntimeVersion));
     WriteAttribute(@"ShadowCopyFiles", @"", System.Xml.XmlConvert.ToString((global::System.Boolean)((global::System.Boolean)o.@ShadowCopyFiles)));
     WriteAttribute(@"CreateSandboxedAppDomain", @"", ((global::System.String)o.@CreateSandboxedAppDomain));
     WriteAttribute(@"Language", @"", ((global::System.String)o.@Language));
     WriteAttribute(@"CompilerVersion", @"", ((global::System.String)o.@CompilerVersion));
     WriteAttribute(@"DefaultReferences", @"", System.Xml.XmlConvert.ToString((global::System.Boolean)((global::System.Boolean)o.@DefaultReferences)));
     WriteAttribute(@"DefaultImports", @"", System.Xml.XmlConvert.ToString((global::System.Boolean)((global::System.Boolean)o.@DefaultImports)));
     {
         global::System.Collections.Generic.List<global::ExcelDna.Integration.ExternalLibrary> a = (global::System.Collections.Generic.List<global::ExcelDna.Integration.ExternalLibrary>)o.@ExternalLibraries;
         if (a != null) {
             for (int ia = 0; ia < ((System.Collections.ICollection)a).Count; ia++) {
                 Write2_ExternalLibrary(@"ExternalLibrary", @"", ((global::ExcelDna.Integration.ExternalLibrary)a[ia]), false, false);
             }
         }
     }
     {
         global::System.Collections.Generic.List<global::ExcelDna.Integration.Project> a = (global::System.Collections.Generic.List<global::ExcelDna.Integration.Project>)o.@Projects;
         if (a != null) {
             for (int ia = 0; ia < ((System.Collections.ICollection)a).Count; ia++) {
                 Write5_Project(@"Project", @"", ((global::ExcelDna.Integration.Project)a[ia]), false, false);
             }
         }
     }
     {
         global::System.Collections.Generic.List<global::ExcelDna.Integration.Reference> a = (global::System.Collections.Generic.List<global::ExcelDna.Integration.Reference>)o.@References;
         if (a != null) {
             for (int ia = 0; ia < ((System.Collections.ICollection)a).Count; ia++) {
                 Write3_Reference(@"Reference", @"", ((global::ExcelDna.Integration.Reference)a[ia]), false, false);
             }
         }
     }
     if ((object)(o.@Code) != null){
         WriteValue(((global::System.String)o.@Code));
     }
     {
         global::System.Collections.Generic.List<global::System.Xml.XmlNode> a = (global::System.Collections.Generic.List<global::System.Xml.XmlNode>)o.@CustomUIs;
         if (a != null) {
             for (int ia = 0; ia < ((System.Collections.ICollection)a).Count; ia++) {
                 if ((((global::System.Xml.XmlNode)a[ia])) is System.Xml.XmlNode || ((global::System.Xml.XmlNode)a[ia]) == null) {
                     WriteElementLiteral((System.Xml.XmlNode)((global::System.Xml.XmlNode)a[ia]), @"CustomUI", @"", false, false);
                 }
                 else {
                     throw CreateInvalidAnyTypeException(((global::System.Xml.XmlNode)a[ia]));
                 }
             }
         }
     }
     {
         global::System.Collections.Generic.List<global::ExcelDna.Integration.Image> a = (global::System.Collections.Generic.List<global::ExcelDna.Integration.Image>)o.@Images;
         if (a != null) {
             for (int ia = 0; ia < ((System.Collections.ICollection)a).Count; ia++) {
                 Write6_Image(@"Image", @"", ((global::ExcelDna.Integration.Image)a[ia]), false, false);
             }
         }
     }
     WriteEndElement(o);
 }
 void Write8_ReturnValue(string n, string ns, global::Generator.ReturnValue o, bool isNullable, bool needType)
 {
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::Generator.ReturnValue)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(@"ReturnValue", @"");
     WriteAttribute(@"type", @"", ((global::System.String)o.@Type));
     WriteEndElement(o);
 }
 void Write11_IOSLaunchOptions(string n, string ns, global::MICore.Xml.LaunchOptions.IOSLaunchOptions o, bool isNullable, bool needType) {
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::MICore.Xml.LaunchOptions.IOSLaunchOptions)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(null, @"http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014");
     WriteAttribute(@"RemoteMachineName", @"", ((global::System.String)o.@RemoteMachineName));
     WriteAttribute(@"PackageId", @"", ((global::System.String)o.@PackageId));
     WriteAttribute(@"vcremotePort", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)o.@vcremotePort)));
     WriteAttribute(@"IOSDebugTarget", @"", Write9_IOSLaunchOptionsIOSDebugTarget(((global::MICore.Xml.LaunchOptions.IOSLaunchOptionsIOSDebugTarget)o.@IOSDebugTarget)));
     WriteAttribute(@"Secure", @"", Write10_IOSLaunchOptionsSecure(((global::MICore.Xml.LaunchOptions.IOSLaunchOptionsSecure)o.@Secure)));
     WriteAttribute(@"TargetArchitecture", @"", Write1_TargetArchitecture(((global::MICore.Xml.LaunchOptions.TargetArchitecture)o.@TargetArchitecture)));
     WriteAttribute(@"AdditionalSOLibSearchPath", @"", ((global::System.String)o.@AdditionalSOLibSearchPath));
     if (o.@MIModeSpecified) {
         WriteAttribute(@"MIMode", @"", Write2_MIMode(((global::MICore.Xml.LaunchOptions.MIMode)o.@MIMode)));
     }
     if (o.@MIModeSpecified) {
     }
     WriteEndElement(o);
 }
 void Write15_BlackBerryLaunchOptions(string n, string ns, global::MICore.Xml.LaunchOptions.BlackBerryLaunchOptions o, bool isNullable, bool needType) {
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::MICore.Xml.LaunchOptions.BlackBerryLaunchOptions)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(null, @"http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014");
     WriteAttribute(@"GdbPath", @"", ((global::System.String)o.@GdbPath));
     WriteAttribute(@"GdbHostPath", @"", ((global::System.String)o.@GdbHostPath));
     WriteAttribute(@"TargetAddress", @"", ((global::System.String)o.@TargetAddress));
     if (((global::System.UInt32)o.@TargetPort) != (System.UInt32)(8000)) {
         WriteAttribute(@"TargetPort", @"", System.Xml.XmlConvert.ToString((global::System.UInt32)((global::System.UInt32)o.@TargetPort)));
     }
     WriteAttribute(@"TargetType", @"", Write14_Item(((global::MICore.Xml.LaunchOptions.BlackBerryLaunchOptionsTargetType)o.@TargetType)));
     if (((global::System.Boolean)o.@Attach) != false) {
         WriteAttribute(@"Attach", @"", System.Xml.XmlConvert.ToString((global::System.Boolean)((global::System.Boolean)o.@Attach)));
     }
     WriteAttribute(@"PID", @"", System.Xml.XmlConvert.ToString((global::System.UInt32)((global::System.UInt32)o.@PID)));
     WriteAttribute(@"NdkHostPath", @"", ((global::System.String)o.@NdkHostPath));
     WriteAttribute(@"NdkTargetPath", @"", ((global::System.String)o.@NdkTargetPath));
     WriteAttribute(@"TargetArchitecture", @"", Write1_TargetArchitecture(((global::MICore.Xml.LaunchOptions.TargetArchitecture)o.@TargetArchitecture)));
     WriteAttribute(@"AdditionalSOLibSearchPath", @"", ((global::System.String)o.@AdditionalSOLibSearchPath));
     if (o.@MIModeSpecified) {
         WriteAttribute(@"MIMode", @"", Write2_MIMode(((global::MICore.Xml.LaunchOptions.MIMode)o.@MIMode)));
     }
     if (o.@MIModeSpecified) {
     }
     WriteEndElement(o);
 }
 void Write4_AndroidLaunchOptions(string n, string ns, global::MICore.Xml.LaunchOptions.AndroidLaunchOptions o, bool isNullable, bool needType) {
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::MICore.Xml.LaunchOptions.AndroidLaunchOptions)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(null, @"http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014");
     WriteAttribute(@"Package", @"", ((global::System.String)o.@Package));
     WriteAttribute(@"LaunchActivity", @"", ((global::System.String)o.@LaunchActivity));
     WriteAttribute(@"SDKRoot", @"", ((global::System.String)o.@SDKRoot));
     WriteAttribute(@"NDKRoot", @"", ((global::System.String)o.@NDKRoot));
     WriteAttribute(@"IntermediateDirectory", @"", ((global::System.String)o.@IntermediateDirectory));
     WriteAttribute(@"DeviceId", @"", ((global::System.String)o.@DeviceId));
     WriteAttribute(@"LogcatServiceId", @"", ((global::System.String)o.@LogcatServiceId));
     if (((global::System.Boolean)o.@Attach) != false) {
         WriteAttribute(@"Attach", @"", System.Xml.XmlConvert.ToString((global::System.Boolean)((global::System.Boolean)o.@Attach)));
     }
     if ((((global::System.String)o.@SourceRoots) != null) && (((global::System.String)o.@SourceRoots).Length != 0)) {
         WriteAttribute(@"SourceRoots", @"", ((global::System.String)o.@SourceRoots));
     }
     if (((global::System.Int32)o.@JVMPort) != 65534) {
         WriteAttribute(@"JVMPort", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)o.@JVMPort)));
     }
     if (((global::System.String)o.@JVMHost) != @"localhost") {
         WriteAttribute(@"JVMHost", @"", ((global::System.String)o.@JVMHost));
     }
     WriteAttribute(@"TargetArchitecture", @"", Write1_TargetArchitecture(((global::MICore.Xml.LaunchOptions.TargetArchitecture)o.@TargetArchitecture)));
     WriteAttribute(@"AdditionalSOLibSearchPath", @"", ((global::System.String)o.@AdditionalSOLibSearchPath));
     if (o.@MIModeSpecified) {
         WriteAttribute(@"MIMode", @"", Write2_MIMode(((global::MICore.Xml.LaunchOptions.MIMode)o.@MIMode)));
     }
     if (o.@MIModeSpecified) {
     }
     WriteEndElement(o);
 }
 void Write5_MetadataFile(string n, string ns, global::System.Web.Compilation.WCFModel.MetadataFile o, bool isNullable, bool needType) {
     if ((object)o == null) {
         if (isNullable) WriteNullTagLiteral(n, ns);
         return;
     }
     if (!needType) {
         System.Type t = o.GetType();
         if (t == typeof(global::System.Web.Compilation.WCFModel.MetadataFile)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(@"MetadataFile", @"urn:schemas-microsoft-com:xml-dataservicemap");
     WriteAttribute(@"FileName", @"", ((global::System.String)o.@FileName));
     WriteAttribute(@"MetadataType", @"", Write4_MetadataType(((global::System.Web.Compilation.WCFModel.MetadataFile.MetadataType)o.@FileType)));
     WriteAttribute(@"ID", @"", ((global::System.String)o.@ID));
     if (o.@IgnoreSpecified) {
         WriteAttribute(@"Ignore", @"", System.Xml.XmlConvert.ToString((global::System.Boolean)((global::System.Boolean)o.@Ignore)));
     }
     if (o.@IsMergeResultSpecified) {
         WriteAttribute(@"IsMergeResult", @"", System.Xml.XmlConvert.ToString((global::System.Boolean)((global::System.Boolean)o.@IsMergeResult)));
     }
     if (o.@SourceIdSpecified) {
         WriteAttribute(@"SourceId", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)o.@SourceId)));
     }
     WriteAttribute(@"SourceUrl", @"", ((global::System.String)o.@SourceUrl));
     if (o.@IgnoreSpecified) {
     }
     if (o.@IsMergeResultSpecified) {
     }
     if (o.@SourceIdSpecified) {
     }
     WriteEndElement(o);
 }