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));
     WriteEndElement(o);
 }
 global::ExcelDna.Integration.ExternalLibrary Read2_ExternalLibrary(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.ExternalLibrary o;
     o = new global::ExcelDna.Integration.ExternalLibrary();
     bool[] paramsRead = new bool[6];
     while (Reader.MoveToNextAttribute()) {
         if (!paramsRead[0] && ((object) Reader.LocalName == (object)id16_Path && (object) Reader.NamespaceURI == (object)id2_Item)) {
             o.@Path = Reader.Value;
             paramsRead[0] = true;
         }
         else if (!paramsRead[1] && ((object) Reader.LocalName == (object)id22_TypeLibPath && (object) Reader.NamespaceURI == (object)id2_Item)) {
             o.@TypeLibPath = Reader.Value;
             paramsRead[1] = true;
         }
         else if (!paramsRead[2] && ((object) Reader.LocalName == (object)id20_ComServer && (object) Reader.NamespaceURI == (object)id2_Item)) {
             o.@ComServer = System.Xml.XmlConvert.ToBoolean(Reader.Value);
             paramsRead[2] = true;
         }
         else if (!paramsRead[3] && ((object) Reader.LocalName == (object)id17_Pack && (object) Reader.NamespaceURI == (object)id2_Item)) {
             o.@Pack = System.Xml.XmlConvert.ToBoolean(Reader.Value);
             paramsRead[3] = true;
         }
         else if (!paramsRead[4] && ((object) Reader.LocalName == (object)id23_LoadFromBytes && (object) Reader.NamespaceURI == (object)id2_Item)) {
             o.@LoadFromBytes = System.Xml.XmlConvert.ToBoolean(Reader.Value);
             paramsRead[4] = true;
         }
         else if (!paramsRead[5] && ((object) Reader.LocalName == (object)id19_ExplicitExports && (object) Reader.NamespaceURI == (object)id2_Item)) {
             o.@ExplicitExports = System.Xml.XmlConvert.ToBoolean(Reader.Value);
             paramsRead[5] = true;
         }
         else if (!IsXmlnsAttribute(Reader.Name)) {
             UnknownNode((object)o, @":Path, :TypeLibPath, :ComServer, :Pack, :LoadFromBytes, :ExplicitExports");
         }
     }
     Reader.MoveToElement();
     if (Reader.IsEmptyElement) {
         Reader.Skip();
         return o;
     }
     Reader.ReadStartElement();
     Reader.MoveToContent();
     int whileIterations5 = 0;
     int readerCount5 = ReaderCount;
     while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) {
         if (Reader.NodeType == System.Xml.XmlNodeType.Element) {
             UnknownNode((object)o, @"");
         }
         else {
             UnknownNode((object)o, @"");
         }
         Reader.MoveToContent();
         CheckReaderCount(ref whileIterations5, ref readerCount5);
     }
     ReadEndElement();
     return o;
 }
 global::ExcelDna.Integration.ExternalLibrary Read2_ExternalLibrary(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.ExternalLibrary o;
     o = new global::ExcelDna.Integration.ExternalLibrary();
     bool[] paramsRead = new bool[1];
     while (Reader.MoveToNextAttribute())
     {
         if (!paramsRead[0] && ((object)Reader.LocalName == (object)id12_Path && (object)Reader.NamespaceURI == (object)id2_Item))
         {
             o.@Path = Reader.Value;
             paramsRead[0] = true;
         }
         else if (!IsXmlnsAttribute(Reader.Name))
         {
             UnknownNode((object)o, @":Path");
         }
     }
     Reader.MoveToElement();
     if (Reader.IsEmptyElement)
     {
         Reader.Skip();
         return o;
     }
     Reader.ReadStartElement();
     Reader.MoveToContent();
     int whileIterations4 = 0;
     int readerCount4 = ReaderCount;
     while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None)
     {
         if (Reader.NodeType == System.Xml.XmlNodeType.Element)
         {
             UnknownNode((object)o, @"");
         }
         else
         {
             UnknownNode((object)o, @"");
         }
         Reader.MoveToContent();
         CheckReaderCount(ref whileIterations4, ref readerCount4);
     }
     ReadEndElement();
     return o;
 }
        global::ExcelDna.Integration.ExternalLibrary Read2_ExternalLibrary(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.ExternalLibrary o;
            o = new global::ExcelDna.Integration.ExternalLibrary();
            bool[] paramsRead = new bool[1];
            while (Reader.MoveToNextAttribute())
            {
                if (!paramsRead[0] && ((object)Reader.LocalName == (object)id12_Path && (object)Reader.NamespaceURI == (object)id2_Item))
                {
                    o.@Path       = Reader.Value;
                    paramsRead[0] = true;
                }
                else if (!IsXmlnsAttribute(Reader.Name))
                {
                    UnknownNode((object)o, @":Path");
                }
            }
            Reader.MoveToElement();
            if (Reader.IsEmptyElement)
            {
                Reader.Skip();
                return(o);
            }
            Reader.ReadStartElement();
            Reader.MoveToContent();
            int whileIterations4 = 0;
            int readerCount4     = ReaderCount;

            while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None)
            {
                if (Reader.NodeType == System.Xml.XmlNodeType.Element)
                {
                    UnknownNode((object)o, @"");
                }
                else
                {
                    UnknownNode((object)o, @"");
                }
                Reader.MoveToContent();
                CheckReaderCount(ref whileIterations4, ref readerCount4);
            }
            ReadEndElement();
            return(o);
        }