private void Write188_CustomBackgroundWorker(string n, string ns, CustomBackgroundWorker o, bool isNullable, bool needType)
 {
     if (o == null)
     {
         if (isNullable)
         {
             base.WriteNullTagLiteral(n, ns);
         }
     }
     else
     {
         if (!needType)
         {
             System.Type type = o.GetType();
             if (type != typeof(CustomBackgroundWorker))
             {
                 if (type == typeof(EventBackgroundWorker))
                 {
                     this.Write189_EventBackgroundWorker(n, ns, (EventBackgroundWorker) o, isNullable, true);
                     return;
                 }
                 if (type != typeof(CustomAsyncFolder))
                 {
                     throw base.CreateUnknownTypeException(o);
                 }
                 this.Write194_CustomAsyncFolder(n, ns, (CustomAsyncFolder) o, isNullable, true);
                 return;
             }
         }
         base.WriteStartElement(n, ns, o, false, null);
         if (needType)
         {
             base.WriteXsiType("CustomBackgroundWorker", "");
         }
         base.WriteElementStringRaw("CancellationPending", "", XmlConvert.ToString(o.CancellationPending));
         base.WriteEndElement(o);
     }
 }
 private CustomBackgroundWorker Read188_CustomBackgroundWorker(bool isNullable, bool checkType)
 {
     XmlQualifiedName type = checkType ? base.GetXsiType() : null;
     bool flag = false;
     if (isNullable)
     {
         flag = base.ReadNull();
     }
     if ((checkType && (type != null)) && ((type.Name != this.id142_CustomBackgroundWorker) || (type.Namespace != this.id2_Item)))
     {
         if ((type.Name == this.id143_EventBackgroundWorker) && (type.Namespace == this.id2_Item))
         {
             return this.Read189_EventBackgroundWorker(isNullable, false);
         }
         if ((type.Name != this.id149_CustomAsyncFolder) || (type.Namespace != this.id2_Item))
         {
             throw base.CreateUnknownTypeException(type);
         }
         return this.Read194_CustomAsyncFolder(isNullable, false);
     }
     if (flag)
     {
         return null;
     }
     CustomBackgroundWorker o = new CustomBackgroundWorker();
     bool[] flagArray = new bool[1];
     while (base.Reader.MoveToNextAttribute())
     {
         if (!base.IsXmlnsAttribute(base.Reader.Name))
         {
             base.UnknownNode(o);
         }
     }
     base.Reader.MoveToElement();
     if (base.Reader.IsEmptyElement)
     {
         base.Reader.Skip();
         return o;
     }
     base.Reader.ReadStartElement();
     base.Reader.MoveToContent();
     int whileIterations = 0;
     int readerCount = base.ReaderCount;
     while ((base.Reader.NodeType != XmlNodeType.EndElement) && (base.Reader.NodeType != XmlNodeType.None))
     {
         if (base.Reader.NodeType == XmlNodeType.Element)
         {
             if ((!flagArray[0] && (base.Reader.LocalName == this.id168_CancellationPending)) && (base.Reader.NamespaceURI == this.id2_Item))
             {
                 o.CancellationPending = XmlConvert.ToBoolean(base.Reader.ReadElementString());
                 flagArray[0] = true;
             }
             else
             {
                 base.UnknownNode(o, ":CancellationPending");
             }
         }
         else
         {
             base.UnknownNode(o, ":CancellationPending");
         }
         base.Reader.MoveToContent();
         base.CheckReaderCount(ref whileIterations, ref readerCount);
     }
     base.ReadEndElement();
     return o;
 }