global::ExcelDna.Integration.DnaLibrary Read6_DnaLibrary(bool isNullable, bool checkType)
        {
            System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null;
            bool isNull = false;

            if (isNullable)
            {
                isNull = ReadNull();
            }
            if (checkType)
            {
                if (xsiType == null || ((object)((System.Xml.XmlQualifiedName)xsiType).Name == (object)id2_Item && (object)((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item))
                {
                }
                else
                {
                    throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType);
                }
            }
            if (isNull)
            {
                return(null);
            }
            global::ExcelDna.Integration.DnaLibrary o;
            o = new global::ExcelDna.Integration.DnaLibrary();
            if ((object)(o.@ExternalLibraries) == null)
            {
                o.@ExternalLibraries = new global::System.Collections.Generic.List <global::ExcelDna.Integration.ExternalLibrary>();
            }
            global::System.Collections.Generic.List <global::ExcelDna.Integration.ExternalLibrary> a_0 = (global::System.Collections.Generic.List <global::ExcelDna.Integration.ExternalLibrary>)o.@ExternalLibraries;
            if ((object)(o.@Projects) == null)
            {
                o.@Projects = new global::System.Collections.Generic.List <global::ExcelDna.Integration.Project>();
            }
            global::System.Collections.Generic.List <global::ExcelDna.Integration.Project> a_1 = (global::System.Collections.Generic.List <global::ExcelDna.Integration.Project>)o.@Projects;
            if ((object)(o.@References) == null)
            {
                o.@References = new global::System.Collections.Generic.List <global::ExcelDna.Integration.Reference>();
            }
            global::System.Collections.Generic.List <global::ExcelDna.Integration.Reference> a_3 = (global::System.Collections.Generic.List <global::ExcelDna.Integration.Reference>)o.@References;
            bool[] paramsRead = new bool[8];
            while (Reader.MoveToNextAttribute())
            {
                if (!paramsRead[2] && ((object)Reader.LocalName == (object)id3_Name && (object)Reader.NamespaceURI == (object)id2_Item))
                {
                    o.@Name       = Reader.Value;
                    paramsRead[2] = true;
                }
                else if (!paramsRead[4] && ((object)Reader.LocalName == (object)id4_Language && (object)Reader.NamespaceURI == (object)id2_Item))
                {
                    o.@Language   = Reader.Value;
                    paramsRead[4] = true;
                }
                else if (!paramsRead[5] && ((object)Reader.LocalName == (object)id5_DefaultReferences && (object)Reader.NamespaceURI == (object)id2_Item))
                {
                    o.@DefaultReferences = System.Xml.XmlConvert.ToBoolean(Reader.Value);
                    paramsRead[5]        = true;
                }
                else if (!paramsRead[6] && ((object)Reader.LocalName == (object)id6_DefaultImports && (object)Reader.NamespaceURI == (object)id2_Item))
                {
                    o.@DefaultImports = System.Xml.XmlConvert.ToBoolean(Reader.Value);
                    paramsRead[6]     = true;
                }
                else if (!IsXmlnsAttribute(Reader.Name))
                {
                    UnknownNode((object)o, @":Name, :Language, :DefaultReferences, :DefaultImports");
                }
            }
            Reader.MoveToElement();
            if (Reader.IsEmptyElement)
            {
                Reader.Skip();
                return(o);
            }
            Reader.ReadStartElement();
            Reader.MoveToContent();
            int whileIterations0 = 0;
            int readerCount0     = ReaderCount;

            while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None)
            {
                string tmp = null;
                if (Reader.NodeType == System.Xml.XmlNodeType.Element)
                {
                    if (((object)Reader.LocalName == (object)id7_ExternalLibrary && (object)Reader.NamespaceURI == (object)id2_Item))
                    {
                        if ((object)(a_0) == null)
                        {
                            Reader.Skip();
                        }
                        else
                        {
                            a_0.Add(Read2_ExternalLibrary(false, true));
                        }
                    }
                    else if (((object)Reader.LocalName == (object)id8_Project && (object)Reader.NamespaceURI == (object)id2_Item))
                    {
                        if ((object)(a_1) == null)
                        {
                            Reader.Skip();
                        }
                        else
                        {
                            a_1.Add(Read5_Project(false, true));
                        }
                    }
                    else if (((object)Reader.LocalName == (object)id9_Reference && (object)Reader.NamespaceURI == (object)id2_Item))
                    {
                        if ((object)(a_3) == null)
                        {
                            Reader.Skip();
                        }
                        else
                        {
                            a_3.Add(Read3_Reference(false, true));
                        }
                    }
                    else
                    {
                        UnknownNode((object)o, @":ExternalLibrary, :Project, :Reference");
                    }
                }
                else if (Reader.NodeType == System.Xml.XmlNodeType.Text ||
                         Reader.NodeType == System.Xml.XmlNodeType.CDATA ||
                         Reader.NodeType == System.Xml.XmlNodeType.Whitespace ||
                         Reader.NodeType == System.Xml.XmlNodeType.SignificantWhitespace)
                {
                    tmp     = ReadString(tmp, false);
                    o.@Code = tmp;
                }
                else
                {
                    UnknownNode((object)o, @":ExternalLibrary, :Project, :Reference");
                }
                Reader.MoveToContent();
                CheckReaderCount(ref whileIterations0, ref readerCount0);
            }
            ReadEndElement();
            return(o);
        }
 global::ExcelDna.Integration.DnaLibrary Read7_DnaLibrary(bool isNullable, bool checkType)
 {
     System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null;
     bool isNull = false;
     if (isNullable) isNull = ReadNull();
     if (checkType) {
     if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id2_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) {
     }
     else
         throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType);
     }
     if (isNull) return null;
     global::ExcelDna.Integration.DnaLibrary o;
     o = new global::ExcelDna.Integration.DnaLibrary();
     if ((object)(o.@ExternalLibraries) == null) o.@ExternalLibraries = new global::System.Collections.Generic.List<global::ExcelDna.Integration.ExternalLibrary>();
     global::System.Collections.Generic.List<global::ExcelDna.Integration.ExternalLibrary> a_0 = (global::System.Collections.Generic.List<global::ExcelDna.Integration.ExternalLibrary>)o.@ExternalLibraries;
     if ((object)(o.@Projects) == null) o.@Projects = new global::System.Collections.Generic.List<global::ExcelDna.Integration.Project>();
     global::System.Collections.Generic.List<global::ExcelDna.Integration.Project> a_1 = (global::System.Collections.Generic.List<global::ExcelDna.Integration.Project>)o.@Projects;
     if ((object)(o.@References) == null) o.@References = new global::System.Collections.Generic.List<global::ExcelDna.Integration.Reference>();
     global::System.Collections.Generic.List<global::ExcelDna.Integration.Reference> a_6 = (global::System.Collections.Generic.List<global::ExcelDna.Integration.Reference>)o.@References;
     if ((object)(o.@CustomUIs) == null) o.@CustomUIs = new global::System.Collections.Generic.List<global::System.Xml.XmlNode>();
     global::System.Collections.Generic.List<global::System.Xml.XmlNode> a_12 = (global::System.Collections.Generic.List<global::System.Xml.XmlNode>)o.@CustomUIs;
     if ((object)(o.@Images) == null) o.@Images = new global::System.Collections.Generic.List<global::ExcelDna.Integration.Image>();
     global::System.Collections.Generic.List<global::ExcelDna.Integration.Image> a_13 = (global::System.Collections.Generic.List<global::ExcelDna.Integration.Image>)o.@Images;
     bool[] paramsRead = new bool[14];
     while (Reader.MoveToNextAttribute()) {
         if (!paramsRead[2] && ((object) Reader.LocalName == (object)id3_Name && (object) Reader.NamespaceURI == (object)id2_Item)) {
             o.@Name = Reader.Value;
             paramsRead[2] = true;
         }
         else if (!paramsRead[3] && ((object) Reader.LocalName == (object)id4_RuntimeVersion && (object) Reader.NamespaceURI == (object)id2_Item)) {
             o.@RuntimeVersion = Reader.Value;
             paramsRead[3] = true;
         }
         else if (!paramsRead[4] && ((object) Reader.LocalName == (object)id5_ShadowCopyFiles && (object) Reader.NamespaceURI == (object)id2_Item)) {
             o.@ShadowCopyFiles = System.Xml.XmlConvert.ToBoolean(Reader.Value);
             paramsRead[4] = true;
         }
         else if (!paramsRead[5] && ((object) Reader.LocalName == (object)id6_CreateSandboxedAppDomain && (object) Reader.NamespaceURI == (object)id2_Item)) {
             o.@CreateSandboxedAppDomain = Reader.Value;
             paramsRead[5] = true;
         }
         else if (!paramsRead[7] && ((object) Reader.LocalName == (object)id7_Language && (object) Reader.NamespaceURI == (object)id2_Item)) {
             o.@Language = Reader.Value;
             paramsRead[7] = true;
         }
         else if (!paramsRead[8] && ((object) Reader.LocalName == (object)id8_CompilerVersion && (object) Reader.NamespaceURI == (object)id2_Item)) {
             o.@CompilerVersion = Reader.Value;
             paramsRead[8] = true;
         }
         else if (!paramsRead[9] && ((object) Reader.LocalName == (object)id9_DefaultReferences && (object) Reader.NamespaceURI == (object)id2_Item)) {
             o.@DefaultReferences = System.Xml.XmlConvert.ToBoolean(Reader.Value);
             paramsRead[9] = true;
         }
         else if (!paramsRead[10] && ((object) Reader.LocalName == (object)id10_DefaultImports && (object) Reader.NamespaceURI == (object)id2_Item)) {
             o.@DefaultImports = System.Xml.XmlConvert.ToBoolean(Reader.Value);
             paramsRead[10] = true;
         }
         else if (!IsXmlnsAttribute(Reader.Name)) {
             UnknownNode((object)o, @":Name, :RuntimeVersion, :ShadowCopyFiles, :CreateSandboxedAppDomain, :Language, :CompilerVersion, :DefaultReferences, :DefaultImports");
         }
     }
     Reader.MoveToElement();
     if (Reader.IsEmptyElement) {
         Reader.Skip();
         return o;
     }
     Reader.ReadStartElement();
     Reader.MoveToContent();
     int whileIterations0 = 0;
     int readerCount0 = ReaderCount;
     while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) {
         string tmp = null;
         if (Reader.NodeType == System.Xml.XmlNodeType.Element) {
             if (((object) Reader.LocalName == (object)id11_ExternalLibrary && (object) Reader.NamespaceURI == (object)id2_Item)) {
                 if ((object)(a_0) == null) Reader.Skip(); else a_0.Add(Read2_ExternalLibrary(false, true));
             }
             else if (((object) Reader.LocalName == (object)id12_Project && (object) Reader.NamespaceURI == (object)id2_Item)) {
                 if ((object)(a_1) == null) Reader.Skip(); else a_1.Add(Read5_Project(false, true));
             }
             else if (((object) Reader.LocalName == (object)id13_Reference && (object) Reader.NamespaceURI == (object)id2_Item)) {
                 if ((object)(a_6) == null) Reader.Skip(); else a_6.Add(Read3_Reference(false, true));
             }
             else if (((object) Reader.LocalName == (object)id14_CustomUI && (object) Reader.NamespaceURI == (object)id2_Item)) {
                 a_12.Add((global::System.Xml.XmlNode)ReadXmlNode(true));
             }
             else if (((object) Reader.LocalName == (object)id15_Image && (object) Reader.NamespaceURI == (object)id2_Item)) {
                 if ((object)(a_13) == null) Reader.Skip(); else a_13.Add(Read6_Image(false, true));
             }
             else {
                 UnknownNode((object)o, @":ExternalLibrary, :Project, :Reference, :CustomUI, :Image");
             }
         }
         else if (Reader.NodeType == System.Xml.XmlNodeType.Text ||
         Reader.NodeType == System.Xml.XmlNodeType.CDATA ||
         Reader.NodeType == System.Xml.XmlNodeType.Whitespace ||
         Reader.NodeType == System.Xml.XmlNodeType.SignificantWhitespace) {
             tmp = ReadString(tmp, false);
             o.@Code = tmp;
         }
         else {
             UnknownNode((object)o, @":ExternalLibrary, :Project, :Reference, :CustomUI, :Image");
         }
         Reader.MoveToContent();
         CheckReaderCount(ref whileIterations0, ref readerCount0);
     }
     ReadEndElement();
     return o;
 }
 void Write6_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(@"Language", @"", ((global::System.String)o.@Language));
     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);
             }
         }
     }
     {
         WriteValue(((global::System.String)o.@Code));
     }
     WriteEndElement(o);
 }