void Write3_Products(string n, string ns, global::Catalog.Products 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::Catalog.Products)) { } else { throw CreateUnknownTypeException(o); } } WriteStartElement(n, ns, o, false, null); if (needType) { WriteXsiType(@"Products", @""); } WriteElementStringRaw(@"Id", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)o.@Id))); WriteElementStringRaw(@"CategoryId", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)o.@CategoryId))); WriteElementString(@"Name", @"", ((global::System.String)o.@Name)); WriteElementStringRaw(@"Price", @"", System.Xml.XmlConvert.ToString((global::System.Single)((global::System.Single)o.@Price))); WriteEndElement(o); }
global::Catalog.Products Read3_Products(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)id4_Products && (object)((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); } } if (isNull) { return(null); } global::Catalog.Products o; o = new global::Catalog.Products(); bool[] paramsRead = new bool[4]; 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) { do { if (!paramsRead[0] && ((object)Reader.LocalName == (object)id5_Id && (object)Reader.NamespaceURI == (object)id2_Item)) { { o.@Id = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); } paramsRead[0] = true; break; } if (!paramsRead[1] && ((object)Reader.LocalName == (object)id6_CategoryId && (object)Reader.NamespaceURI == (object)id2_Item)) { { o.@CategoryId = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); } paramsRead[1] = true; break; } if (!paramsRead[2] && ((object)Reader.LocalName == (object)id7_Name && (object)Reader.NamespaceURI == (object)id2_Item)) { { o.@Name = Reader.ReadElementString(); } paramsRead[2] = true; break; } if (!paramsRead[3] && ((object)Reader.LocalName == (object)id8_Price && (object)Reader.NamespaceURI == (object)id2_Item)) { { o.@Price = System.Xml.XmlConvert.ToSingle(Reader.ReadElementString()); } paramsRead[3] = true; break; } UnknownNode((object)o, @":Id, :CategoryId, :Name, :Price"); } while (false); } else { UnknownNode((object)o, @":Id, :CategoryId, :Name, :Price"); } Reader.MoveToContent(); CheckReaderCount(ref whileIterations0, ref readerCount0); } ReadEndElement(); return(o); }