void Write4_PurchaseOrder(string n, string ns, global::uwpSerializer.PurchaseOrder 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::uwpSerializer.PurchaseOrder))
                {
                }
                else
                {
                    throw CreateUnknownTypeException(o);
                }
            }
            WriteStartElement(n, ns, o, false, null);
            if (needType)
            {
                WriteXsiType(@"PurchaseOrder", defaultNamespace);
            }
            string namespace2 = (parentCompileTimeNs == @"http://www.cpandl.com" && parentRuntimeNs != null) ? parentRuntimeNs : @"http://www.cpandl.com";

            Write2_Address(@"ShipTo", namespace2, ((global::uwpSerializer.Address)o.@ShipTo), false, false, namespace2, @"http://www.cpandl.com");
            string namespace3 = (parentCompileTimeNs == @"http://www.cpandl.com" && parentRuntimeNs != null) ? parentRuntimeNs : @"http://www.cpandl.com";

            WriteElementString(@"OrderDate", namespace3, ((global::System.String)o.@OrderDate));
            string namespace4 = (parentCompileTimeNs == @"http://www.cpandl.com" && parentRuntimeNs != null) ? parentRuntimeNs : @"http://www.cpandl.com";
            {
                global::uwpSerializer.OrderedItem[] a = (global::uwpSerializer.OrderedItem[])((global::uwpSerializer.OrderedItem[])o.@OrderedItems);
                if (a != null)
                {
                    WriteStartElement(@"Items", namespace4, null, false);
                    for (int ia = 0; ia < a.Length; ia++)
                    {
                        string namespace5 = (parentCompileTimeNs == @"http://www.cpandl.com" && parentRuntimeNs != null) ? parentRuntimeNs : @"http://www.cpandl.com";
                        Write3_OrderedItem(@"OrderedItem", namespace5, ((global::uwpSerializer.OrderedItem)a[ia]), true, false, namespace5, @"http://www.cpandl.com");
                    }
                    WriteEndElement();
                }
            }
            string namespace6 = (parentCompileTimeNs == @"http://www.cpandl.com" && parentRuntimeNs != null) ? parentRuntimeNs : @"http://www.cpandl.com";

            WriteElementStringRaw(@"SubTotal", namespace6, System.Xml.XmlConvert.ToString((global::System.Decimal)((global::System.Decimal)o.@SubTotal)));
            string namespace7 = (parentCompileTimeNs == @"http://www.cpandl.com" && parentRuntimeNs != null) ? parentRuntimeNs : @"http://www.cpandl.com";

            WriteElementStringRaw(@"ShipCost", namespace7, System.Xml.XmlConvert.ToString((global::System.Decimal)((global::System.Decimal)o.@ShipCost)));
            string namespace8 = (parentCompileTimeNs == @"http://www.cpandl.com" && parentRuntimeNs != null) ? parentRuntimeNs : @"http://www.cpandl.com";

            WriteElementStringRaw(@"TotalCost", namespace8, System.Xml.XmlConvert.ToString((global::System.Decimal)((global::System.Decimal)o.@TotalCost)));
            WriteEndElement(o);
        }
        global::uwpSerializer.PurchaseOrder Read4_PurchaseOrder(bool isNullable, bool checkType, string defaultNamespace = null)
        {
            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)id1_PurchaseOrder && string.Equals(((System.Xml.XmlQualifiedName)xsiType).Namespace, defaultNamespace ?? id2_httpwwwcpandlcom)))
                {
                }
                else
                {
                    throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType);
                }
            }
            if (isNull)
            {
                return(null);
            }
            global::uwpSerializer.PurchaseOrder o;
            o = new global::uwpSerializer.PurchaseOrder();
            global::uwpSerializer.OrderedItem[] a_2 = null;
            int ca_2 = 0;

            bool[] paramsRead = new bool[6];
            while (Reader.MoveToNextAttribute())
            {
                if (!IsXmlnsAttribute(Reader.Name))
                {
                    UnknownNode((object)o);
                }
            }
            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)
            {
                if (Reader.NodeType == System.Xml.XmlNodeType.Element)
                {
                    if (!paramsRead[0] && ((object)Reader.LocalName == (object)id3_ShipTo && string.Equals(Reader.NamespaceURI, defaultNamespace ?? id2_httpwwwcpandlcom)))
                    {
                        o.@ShipTo     = Read2_Address(false, true, defaultNamespace);
                        paramsRead[0] = true;
                    }
                    else if (!paramsRead[1] && ((object)Reader.LocalName == (object)id4_OrderDate && string.Equals(Reader.NamespaceURI, defaultNamespace ?? id2_httpwwwcpandlcom)))
                    {
                        {
                            o.@OrderDate = Reader.ReadElementContentAsString();
                        }
                        paramsRead[1] = true;
                    }
                    else if (((object)Reader.LocalName == (object)id5_Items && string.Equals(Reader.NamespaceURI, defaultNamespace ?? id2_httpwwwcpandlcom)))
                    {
                        if (!ReadNull())
                        {
                            global::uwpSerializer.OrderedItem[] a_2_0 = null;
                            int ca_2_0 = 0;
                            if ((Reader.IsEmptyElement))
                            {
                                Reader.Skip();
                            }
                            else
                            {
                                Reader.ReadStartElement();
                                Reader.MoveToContent();
                                int whileIterations1 = 0;
                                int readerCount1     = ReaderCount;
                                while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None)
                                {
                                    if (Reader.NodeType == System.Xml.XmlNodeType.Element)
                                    {
                                        if (((object)Reader.LocalName == (object)id6_OrderedItem && string.Equals(Reader.NamespaceURI, defaultNamespace ?? id2_httpwwwcpandlcom)))
                                        {
                                            a_2_0 = (global::uwpSerializer.OrderedItem[])EnsureArrayIndex(a_2_0, ca_2_0, typeof(global::uwpSerializer.OrderedItem)); a_2_0[ca_2_0++] = Read3_OrderedItem(true, true, defaultNamespace);
                                        }
                                        else
                                        {
                                            UnknownNode(null, @"http://www.cpandl.com:OrderedItem");
                                        }
                                    }
                                    else
                                    {
                                        UnknownNode(null, @"http://www.cpandl.com:OrderedItem");
                                    }
                                    Reader.MoveToContent();
                                    CheckReaderCount(ref whileIterations1, ref readerCount1);
                                }
                                ReadEndElement();
                            }
                            o.@OrderedItems = (global::uwpSerializer.OrderedItem[])ShrinkArray(a_2_0, ca_2_0, typeof(global::uwpSerializer.OrderedItem), false);
                        }
                    }
                    else if (!paramsRead[3] && ((object)Reader.LocalName == (object)id7_SubTotal && string.Equals(Reader.NamespaceURI, defaultNamespace ?? id2_httpwwwcpandlcom)))
                    {
                        {
                            o.@SubTotal = System.Xml.XmlConvert.ToDecimal(Reader.ReadElementContentAsString());
                        }
                        paramsRead[3] = true;
                    }
                    else if (!paramsRead[4] && ((object)Reader.LocalName == (object)id8_ShipCost && string.Equals(Reader.NamespaceURI, defaultNamespace ?? id2_httpwwwcpandlcom)))
                    {
                        {
                            o.@ShipCost = System.Xml.XmlConvert.ToDecimal(Reader.ReadElementContentAsString());
                        }
                        paramsRead[4] = true;
                    }
                    else if (!paramsRead[5] && ((object)Reader.LocalName == (object)id9_TotalCost && string.Equals(Reader.NamespaceURI, defaultNamespace ?? id2_httpwwwcpandlcom)))
                    {
                        {
                            o.@TotalCost = System.Xml.XmlConvert.ToDecimal(Reader.ReadElementContentAsString());
                        }
                        paramsRead[5] = true;
                    }
                    else
                    {
                        UnknownNode((object)o, @"http://www.cpandl.com:ShipTo, http://www.cpandl.com:OrderDate, http://www.cpandl.com:Items, http://www.cpandl.com:SubTotal, http://www.cpandl.com:ShipCost, http://www.cpandl.com:TotalCost");
                    }
                }
                else
                {
                    UnknownNode((object)o, @"http://www.cpandl.com:ShipTo, http://www.cpandl.com:OrderDate, http://www.cpandl.com:Items, http://www.cpandl.com:SubTotal, http://www.cpandl.com:ShipCost, http://www.cpandl.com:TotalCost");
                }
                Reader.MoveToContent();
                CheckReaderCount(ref whileIterations0, ref readerCount0);
            }
            ReadEndElement();
            return(o);
        }