void Write15_CiscoIPPhoneIconMenuType(string n, string ns, CiscoIPPhoneIconMenuType 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(CiscoIPPhoneIconMenuType)) {
         }
         else {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o, false, null);
     if (needType) WriteXsiType(@"CiscoIPPhoneIconMenuType", @"");
     WriteNullableStringLiteral(@"Title", @"", ((global::System.String)o.@Title));
     WriteNullableStringLiteral(@"Prompt", @"", ((global::System.String)o.@Prompt));
     {
         CiscoIPPhoneIconMenuItemType[] a = (CiscoIPPhoneIconMenuItemType[])o.@MenuItem;
         if (a != null) {
             for (int ia = 0; ia < a.Length; ia++) {
                 Write12_CiscoIPPhoneIconMenuItemType(@"MenuItem", @"", ((CiscoIPPhoneIconMenuItemType)a[ia]), false, false);
             }
         }
     }
     {
         CiscoIPPhoneIconItemType[] a = (CiscoIPPhoneIconItemType[])o.@IconItem;
         if (a != null) {
             for (int ia = 0; ia < a.Length; ia++) {
                 Write11_CiscoIPPhoneIconItemType(@"IconItem", @"", ((CiscoIPPhoneIconItemType)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);
 }
 CiscoIPPhoneIconMenuType Read15_CiscoIPPhoneIconMenuType(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)id67_CiscoIPPhoneIconMenuType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) {
     }
     else
         throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType);
     }
     if (isNull) return null;
     CiscoIPPhoneIconMenuType o;
     o = new CiscoIPPhoneIconMenuType();
     CiscoIPPhoneIconMenuItemType[] a_2 = null;
     int ca_2 = 0;
     CiscoIPPhoneIconItemType[] a_3 = null;
     int ca_3 = 0;
     CiscoIPPhoneSoftKeyType[] a_4 = null;
     int ca_4 = 0;
     bool[] paramsRead = new bool[5];
     while (Reader.MoveToNextAttribute()) {
         if (!IsXmlnsAttribute(Reader.Name)) {
             UnknownNode((object)o);
         }
     }
     Reader.MoveToElement();
     if (Reader.IsEmptyElement) {
         Reader.Skip();
         o.@MenuItem = (CiscoIPPhoneIconMenuItemType[])ShrinkArray(a_2, ca_2, typeof(CiscoIPPhoneIconMenuItemType), true);
         o.@IconItem = (CiscoIPPhoneIconItemType[])ShrinkArray(a_3, ca_3, typeof(CiscoIPPhoneIconItemType), true);
         o.@SoftKeyItem = (CiscoIPPhoneSoftKeyType[])ShrinkArray(a_4, ca_4, typeof(CiscoIPPhoneSoftKeyType), true);
         return o;
     }
     Reader.ReadStartElement();
     Reader.MoveToContent();
     int whileIterations17 = 0;
     int readerCount17 = 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 (((object) Reader.LocalName == (object)id57_MenuItem && (object) Reader.NamespaceURI == (object)id2_Item)) {
                 a_2 = (CiscoIPPhoneIconMenuItemType[])EnsureArrayIndex(a_2, ca_2, typeof(CiscoIPPhoneIconMenuItemType));a_2[ca_2++] = Read12_CiscoIPPhoneIconMenuItemType(false, true);
             }
             else if (((object) Reader.LocalName == (object)id68_IconItem && (object) Reader.NamespaceURI == (object)id2_Item)) {
                 a_3 = (CiscoIPPhoneIconItemType[])EnsureArrayIndex(a_3, ca_3, typeof(CiscoIPPhoneIconItemType));a_3[ca_3++] = Read11_CiscoIPPhoneIconItemType(false, true);
             }
             else if (((object) Reader.LocalName == (object)id51_SoftKeyItem && (object) Reader.NamespaceURI == (object)id2_Item)) {
                 a_4 = (CiscoIPPhoneSoftKeyType[])EnsureArrayIndex(a_4, ca_4, typeof(CiscoIPPhoneSoftKeyType));a_4[ca_4++] = Read3_CiscoIPPhoneSoftKeyType(false, true);
             }
             else {
                 UnknownNode((object)o, @":Title, :Prompt, :MenuItem, :IconItem, :SoftKeyItem");
             }
         }
         else {
             UnknownNode((object)o, @":Title, :Prompt, :MenuItem, :IconItem, :SoftKeyItem");
         }
         Reader.MoveToContent();
         CheckReaderCount(ref whileIterations17, ref readerCount17);
     }
     o.@MenuItem = (CiscoIPPhoneIconMenuItemType[])ShrinkArray(a_2, ca_2, typeof(CiscoIPPhoneIconMenuItemType), true);
     o.@IconItem = (CiscoIPPhoneIconItemType[])ShrinkArray(a_3, ca_3, typeof(CiscoIPPhoneIconItemType), true);
     o.@SoftKeyItem = (CiscoIPPhoneSoftKeyType[])ShrinkArray(a_4, ca_4, typeof(CiscoIPPhoneSoftKeyType), true);
     ReadEndElement();
     return o;
 }