当前位置: 首页>>代码示例>>C#>>正文


C# ArrayList.MoveNext方法代码示例

本文整理汇总了C#中ArrayList.MoveNext方法的典型用法代码示例。如果您正苦于以下问题:C# ArrayList.MoveNext方法的具体用法?C# ArrayList.MoveNext怎么用?C# ArrayList.MoveNext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ArrayList的用法示例。


在下文中一共展示了ArrayList.MoveNext方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: runTest

 public bool runTest()
   {
   Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer);
   int iCountErrors = 0;
   int iCountTestcases = 0;
   String strLoc = "Loc_000oo";
   String strValue = String.Empty;
   try
     {
     DateTime dt1, dt2;
     String str1 = String.Empty;
     CultureInfo ci = CultureInfo.InvariantCulture;
     strLoc = "Loc_498hx";
     iCountTestcases++;
     try {
     dt1 = DateTime.ParseExact(null, "", null);
     iCountErrors++;
     printerr( "Error_98hvc! Expected exception not thrown, dt1=="+dt1.ToString());
     } catch (ArgumentNullException aexc) {
     printinfo( "Info_98hcy! Caught expected ArgumentNullException, aexc=="+aexc.Message);
     } catch (Exception exc) {
     iCountErrors++;
     printerr( "Error_29h8x! Unexpected Exception: "+exc.ToString());
     }
     strLoc = "Loc_49hvh";
     iCountTestcases++;
     try {
     dt1 = DateTime.ParseExact("", null, null);			dt2 = new DateTime(2000, 2, 29, 17, 59, 01);
     iCountErrors++;
     printerr( "Error_458vh! Expected exception not thrown, dt1=="+dt1.ToString());
     } catch (ArgumentNullException aexc) {
     printinfo( "Info_29hce! Caught expected ArgumentNullException, aexc=="+aexc.Message);
     } catch (Exception exc) {
     iCountErrors++;
     printerr( "Error_198zz! Unexpected exception: "+exc.ToString());
     }
     strLoc = "Loc_20jx9";
     iCountTestcases++;
     try {
     dt1 = DateTime.ParseExact("", "G", null);
     iCountErrors++;
     printerr( "Error_298hc! Expected exception not thrown, dt1=="+dt1.ToString());
     } catch (FormatException fExc) {
     printinfo( "Info_98v89! Caught expected exception, fexc=="+fExc.Message);
     } catch (Exception exc) {
     iCountErrors++;
     printerr( "Error_209xq! Unexpected exception: "+exc.ToString());
     }
     strLoc = "Loc_298yg";
     iCountTestcases++;
     try {
     dt1 = DateTime.ParseExact(DateTime.Now.ToString(), "", null);
     iCountErrors++;
     printerr( "Error_2h8x9! Expected exception not thrown, dt1=="+dt1.ToString());
     } catch (FormatException ) {
     } catch (Exception exc) {
     iCountErrors++;
     printerr( "Error_209v9! unexpected exception: "+exc.ToString());
     }
     CultureInfo[] cultinfos = CultureInfo.GetCultures(CultureTypes.AllCultures);
     IEnumerator cultenum = new ArrayList(cultinfos).GetEnumerator();
     strLoc = "Loc_248ch";
     str1 = "-1/10/2000 17:44:22";
     iCountTestcases++;
     try {
     dt1 = DateTime.ParseExact(str1, "G", DateTimeFormatInfo.GetInstance(CultureInfo.InvariantCulture));
     iCountErrors++;
     printerr( "Error_2d333! Expected exception not thrown, dt1=="+dt1.ToString());
     } catch (FormatException fexc) {
     printinfo( "Info_98hcx! Caught expected FormatException, fexc=="+fexc.Message);
     } catch (Exception exc) {
     iCountErrors++;
     printerr( "Error_89hf8! Unexpected exception: "+exc.ToString());
     }
     str1 = "11/31/2000 14:38:22";
     iCountTestcases++;
     try {
     dt1 = DateTime.ParseExact(str1, "G", DateTimeFormatInfo.GetInstance(CultureInfo.InvariantCulture));
     iCountErrors++;
     printerr( "Error_1908x! Expected exception not thrown, dt1=="+dt1.ToString());
     } catch (FormatException fexc) {
     printinfo( "Info_1979s! Caught expected Exception, fexc=="+fexc.Message);
     } catch (Exception exc) {
     iCountErrors++;
     printerr( "Error_287vh! Unexpected exception: "+exc.ToString());
     }
     str1 = "31/11/2000 14:44:22";
     iCountTestcases++;
     try {
     dt1 = DateTime.ParseExact(str1, "G", DateTimeFormatInfo.GetInstance(CultureInfo.InvariantCulture));
     iCountErrors++;
     printerr( "Error_29299! Expected Exception not thrown, dt1=="+dt1.ToString());
     } catch (FormatException fexc) {
     printinfo( "Info_39duh! Caught expected Exception, fexc=="+fexc.Message);
     } catch (Exception exc) {
     iCountErrors++;
     printerr("Error_4h7vc! Unexpected exception: "+exc.ToString());
     }
     while(cultenum.MoveNext()) {
     ci = (CultureInfo)cultenum.Current;
//.........这里部分代码省略.........
开发者ID:ArildF,项目名称:masters,代码行数:101,代码来源:co5506parseexact_str_str_dtfi.cs

示例2: AddAll

        /// <summary>
        /// Adds all of the elements of the "c" collection to the "target" collection.
        /// </summary>
        /// <param name="target">Collection where the new elements will be added.</param>
        /// <param name="c">Collection whose elements will be added.</param>
        /// <returns>Returns true if at least one element was added, false otherwise.</returns>
        public static bool AddAll(ICollection target, ICollection c)
        {
            IEnumerator e = new ArrayList(c).GetEnumerator();
            bool added = false;

            //Reflection. Invoke "addAll" method for proprietary classes
            MethodInfo method;
            try
            {
                method = target.GetType().GetMethod("addAll");

                if (method != null)
                    added = (bool) method.Invoke(target, new object[] { c });
                else
                {
                    method = target.GetType().GetMethod("Add");
                    while (e.MoveNext() == true)
                    {
                        bool tempBAdded = (int) method.Invoke(target, new object[] { e.Current }) >= 0;
                        added = added ? added : tempBAdded;
                    }
                }
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
            return added;
        }
开发者ID:kjk,项目名称:tenderbase,代码行数:35,代码来源:SupportClass.cs

示例3: RetainAll

        /// <summary>
        /// Retains the elements in the target collection that are contained in the specified collection
        /// </summary>
        /// <param name="target">Collection where the elements will be removed.</param>
        /// <param name="c">Elements to be retained in the target collection.</param>
        /// <returns>true</returns>
        public static bool RetainAll(ICollection target, ICollection c)
        {
            IEnumerator e = new ArrayList(target).GetEnumerator();
            ArrayList al = new ArrayList(c);

            //Reflection. Invoke "retainAll" method for proprietary classes or "Remove" for each element in the collection
            MethodInfo method;
            try
            {
                method = c.GetType().GetMethod("retainAll");

                if (method != null)
                    method.Invoke(target, new object[] { c });
                else
                {
                    method = c.GetType().GetMethod("Remove");

                    while (e.MoveNext() == true)
                    {
                        if (al.Contains(e.Current) == false)
                            method.Invoke(target, new object[] { e.Current });
                    }
                }
            }
            catch (System.Exception ex)
            {
                throw ex;
            }

            return true;
        }
开发者ID:kjk,项目名称:tenderbase,代码行数:37,代码来源:SupportClass.cs


注:本文中的ArrayList.MoveNext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。