void Write17_CiscoIPPhoneGraphicMenuType(string n, string ns, CiscoIPPhoneGraphicMenuType 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(CiscoIPPhoneGraphicMenuType)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(@"CiscoIPPhoneGraphicMenuType", @"");
     WriteNullableStringLiteral(@"Title", @"", ((global::System.String)o.@Title));
     WriteNullableStringLiteral(@"Prompt", @"", ((global::System.String)o.@Prompt));
     if (o.@LocationXSpecified) {
         WriteElementStringRaw(@"LocationX", @"", System.Xml.XmlConvert.ToString((global::System.Int16)((global::System.Int16)o.@LocationX)));
     }
     if (o.@LocationYSpecified) {
         WriteElementStringRaw(@"LocationY", @"", System.Xml.XmlConvert.ToString((global::System.Int16)((global::System.Int16)o.@LocationY)));
     }
     WriteElementStringRaw(@"Width", @"", System.Xml.XmlConvert.ToString((global::System.UInt16)((global::System.UInt16)o.@Width)));
     WriteElementStringRaw(@"Height", @"", System.Xml.XmlConvert.ToString((global::System.UInt16)((global::System.UInt16)o.@Height)));
     WriteElementStringRaw(@"Depth", @"", System.Xml.XmlConvert.ToString((global::System.UInt16)((global::System.UInt16)o.@Depth)));
     WriteElementStringRaw(@"Data", @"", FromByteArrayHex(((global::System.Byte[])o.@Data)));
     {
         CiscoIPPhoneMenuItemType[] a = (CiscoIPPhoneMenuItemType[])o.@MenuItem;
         if (a != null) {
             for (int ia = 0; ia < a.Length; ia++) {
                 Write2_CiscoIPPhoneMenuItemType(@"MenuItem", @"", ((CiscoIPPhoneMenuItemType)a[ia]), false, false);
             }
         }
     }
     {
         CiscoIPPhoneSoftKeyType[] a = (CiscoIPPhoneSoftKeyType[])o.@SoftKeyItem;
         if (a != null) {
             for (int ia = 0; ia < a.Length; ia++) {
                 Write3_CiscoIPPhoneSoftKeyType(@"SoftKeyItem", @"", ((CiscoIPPhoneSoftKeyType)a[ia]), false, false);
             }
         }
     }
     WriteEndElement(o);
 }
 CiscoIPPhoneGraphicMenuType Read17_CiscoIPPhoneGraphicMenuType(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)id63_CiscoIPPhoneGraphicMenuType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) {
     }
     else
         throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType);
     }
     if (isNull) return null;
     CiscoIPPhoneGraphicMenuType o;
     o = new CiscoIPPhoneGraphicMenuType();
     CiscoIPPhoneMenuItemType[] a_8 = null;
     int ca_8 = 0;
     CiscoIPPhoneSoftKeyType[] a_9 = null;
     int ca_9 = 0;
     bool[] paramsRead = new bool[10];
     while (Reader.MoveToNextAttribute()) {
         if (!IsXmlnsAttribute(Reader.Name)) {
             UnknownNode((object)o);
         }
     }
     Reader.MoveToElement();
     if (Reader.IsEmptyElement) {
         Reader.Skip();
         o.@MenuItem = (CiscoIPPhoneMenuItemType[])ShrinkArray(a_8, ca_8, typeof(CiscoIPPhoneMenuItemType), true);
         o.@SoftKeyItem = (CiscoIPPhoneSoftKeyType[])ShrinkArray(a_9, ca_9, typeof(CiscoIPPhoneSoftKeyType), true);
         return o;
     }
     Reader.ReadStartElement();
     Reader.MoveToContent();
     int whileIterations13 = 0;
     int readerCount13 = 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)id43_Title && (object) Reader.NamespaceURI == (object)id2_Item)) {
                 if (ReadNull()) {
                     o.@Title = null;
                 }
                 else {
                     o.@Title = Reader.ReadElementString();
                 }
                 paramsRead[0] = true;
             }
             else if (!paramsRead[1] && ((object) Reader.LocalName == (object)id44_Prompt && (object) Reader.NamespaceURI == (object)id2_Item)) {
                 if (ReadNull()) {
                     o.@Prompt = null;
                 }
                 else {
                     o.@Prompt = Reader.ReadElementString();
                 }
                 paramsRead[1] = true;
             }
             else if (!paramsRead[2] && ((object) Reader.LocalName == (object)id28_LocationX && (object) Reader.NamespaceURI == (object)id2_Item)) {
                 o.@LocationXSpecified = true;
                 {
                     o.@LocationX = System.Xml.XmlConvert.ToInt16(Reader.ReadElementString());
                 }
                 paramsRead[2] = true;
             }
             else if (!paramsRead[3] && ((object) Reader.LocalName == (object)id29_LocationY && (object) Reader.NamespaceURI == (object)id2_Item)) {
                 o.@LocationYSpecified = true;
                 {
                     o.@LocationY = System.Xml.XmlConvert.ToInt16(Reader.ReadElementString());
                 }
                 paramsRead[3] = true;
             }
             else if (!paramsRead[4] && ((object) Reader.LocalName == (object)id30_Width && (object) Reader.NamespaceURI == (object)id2_Item)) {
                 {
                     o.@Width = System.Xml.XmlConvert.ToUInt16(Reader.ReadElementString());
                 }
                 paramsRead[4] = true;
             }
             else if (!paramsRead[5] && ((object) Reader.LocalName == (object)id31_Height && (object) Reader.NamespaceURI == (object)id2_Item)) {
                 {
                     o.@Height = System.Xml.XmlConvert.ToUInt16(Reader.ReadElementString());
                 }
                 paramsRead[5] = true;
             }
             else if (!paramsRead[6] && ((object) Reader.LocalName == (object)id32_Depth && (object) Reader.NamespaceURI == (object)id2_Item)) {
                 {
                     o.@Depth = System.Xml.XmlConvert.ToUInt16(Reader.ReadElementString());
                 }
                 paramsRead[6] = true;
             }
             else if (!paramsRead[7] && ((object) Reader.LocalName == (object)id33_Data && (object) Reader.NamespaceURI == (object)id2_Item)) {
                 {
                     o.@Data = ToByteArrayHex(false);
                 }
                 paramsRead[7] = true;
             }
             else if (((object) Reader.LocalName == (object)id57_MenuItem && (object) Reader.NamespaceURI == (object)id2_Item)) {
                 a_8 = (CiscoIPPhoneMenuItemType[])EnsureArrayIndex(a_8, ca_8, typeof(CiscoIPPhoneMenuItemType));a_8[ca_8++] = Read2_CiscoIPPhoneMenuItemType(false, true);
             }
             else if (((object) Reader.LocalName == (object)id51_SoftKeyItem && (object) Reader.NamespaceURI == (object)id2_Item)) {
                 a_9 = (CiscoIPPhoneSoftKeyType[])EnsureArrayIndex(a_9, ca_9, typeof(CiscoIPPhoneSoftKeyType));a_9[ca_9++] = Read3_CiscoIPPhoneSoftKeyType(false, true);
             }
             else {
                 UnknownNode((object)o, @":Title, :Prompt, :LocationX, :LocationY, :Width, :Height, :Depth, :Data, :MenuItem, :SoftKeyItem");
             }
         }
         else {
             UnknownNode((object)o, @":Title, :Prompt, :LocationX, :LocationY, :Width, :Height, :Depth, :Data, :MenuItem, :SoftKeyItem");
         }
         Reader.MoveToContent();
         CheckReaderCount(ref whileIterations13, ref readerCount13);
     }
     o.@MenuItem = (CiscoIPPhoneMenuItemType[])ShrinkArray(a_8, ca_8, typeof(CiscoIPPhoneMenuItemType), true);
     o.@SoftKeyItem = (CiscoIPPhoneSoftKeyType[])ShrinkArray(a_9, ca_9, typeof(CiscoIPPhoneSoftKeyType), true);
     ReadEndElement();
     return o;
 }