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


C# ArrayList.MoveNext方法代码示例

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


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

示例1: 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(System.Collections.ICollection target, System.Collections.ICollection c)
		{
			System.Collections.IEnumerator e = new System.Collections.ArrayList(c).GetEnumerator();
			bool added = false;

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

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

示例2: AddAll

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

            while (e.MoveNext() == true)
            {
                if (this.Add(e.Current) == true)
                    added = true;
            }

            return added;
        }
开发者ID:dezelin,项目名称:maily,代码行数:18,代码来源:HashSet.cs

示例3: AddAll

 public bool AddAll(ICollection c)
 {
     IEnumerator enumerator = new ArrayList(c).GetEnumerator();
     bool flag = false;
     while (enumerator.MoveNext())
     {
         if (this.Add(enumerator.Current))
         {
             flag = true;
         }
     }
     return flag;
 }
开发者ID:89sos98,项目名称:TradingApi.Client.CS,代码行数:13,代码来源:HashSetSupport.cs

示例4: AddAll

 public bool AddAll(ICollection c)
 {
     IEnumerator e = new ArrayList(c).GetEnumerator();
     bool added = false;
     while (e.MoveNext())
     {
         if (AddWithoutSorting(e.Current))
         {
             added = true;
         }
     }
     Sort(comparator);
     return added;
 }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:14,代码来源:TreeSet.cs

示例5: AddAll

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

            while (e.MoveNext() == true)
            {
                if (Add(e.Current) == true)
                {
                    added = true;
                }
            }

            return added;
        }
开发者ID:yuyi1,项目名称:Verdezyne-Operations,代码行数:20,代码来源:HashSet.cs

示例6: AddAll

            /// <summary>
            /// Adds all the elements contained into the specified collection, starting at the specified position.
            /// </summary>
            /// <param name="index">Position at which to add the first element from the specified collection.</param>
            /// <param name="list">The list used to extract the elements that will be added.</param>
            /// <returns>Returns true if all the elements were successfuly added. Otherwise returns false.</returns>
            public static bool AddAll(IList list, int index, ICollection c)
            {
                bool result = false;
                if (c != null)
                {
                    IEnumerator tempEnumerator = new ArrayList(c).GetEnumerator();
                    int tempIndex = index;

                    while (tempEnumerator.MoveNext())
                    {
                        list.Insert(tempIndex++, tempEnumerator.Current);
                        result = true;
                    }
                }

                return result;
            }
开发者ID:pisker,项目名称:mDNS,代码行数:23,代码来源:SupportClass.cs

示例7: AddAll

 public static bool AddAll(ICollection target, ICollection c)
 {
     IEnumerator enumerator = new ArrayList(c).GetEnumerator();
     bool flag = false;
     try
     {
         MethodInfo method = target.GetType().GetMethod("addAll");
         if (method != null)
         {
             return (bool) method.Invoke(target, new object[] { c });
         }
         method = target.GetType().GetMethod("Add");
         while (enumerator.MoveNext())
         {
             bool flag2 = ((int) method.Invoke(target, new object[] { enumerator.Current })) >= 0;
             flag = flag ? flag : flag2;
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
     return flag;
 }
开发者ID:89sos98,项目名称:TradingApi.Client.CS,代码行数:24,代码来源:CollectionsSupport.cs

示例8: 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();
                var al = new ArrayList(c);

                //Reflection. Invoke "retainAll" method for proprietary classes or "Remove" for each Element in the collection
                System.Reflection.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())
                        {
                            if (al.Contains(e.Current) == false)
                                method.Invoke(target, new[] {e.Current});
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }

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

示例9: RemoveAll

			/// <summary>
			/// Removes all the elements contained into the specified collection.
			/// </summary>
			/// <param name="collection">The collection used to extract the elements that will be removed.</param>
			/// <returns>Returns true if all the elements were successfuly removed. Otherwise returns false.</returns>
			public virtual bool RemoveAll(System.Collections.ICollection collection)
			{ 
				bool result = false;
				System.Collections.IEnumerator tempEnumerator = new System.Collections.ArrayList(collection).GetEnumerator();
				while (tempEnumerator.MoveNext())
				{
					if (this.Contains(tempEnumerator.Current))
						result = this.Remove(tempEnumerator.Current);
				}
				return result;
			}
开发者ID:nickchal,项目名称:pash,代码行数:16,代码来源:SupportClass.cs

示例10: ContainsAll

			/// <summary>
			/// Verifies if all the elements of the specified collection are contained into the current collection.
			/// </summary>
			/// <param name="collection">The collection used to extract the elements that will be verified.</param>
			/// <returns>Returns true if all the elements are contained in the collection. Otherwise returns false.</returns>
			public virtual bool ContainsAll(System.Collections.ICollection collection)
			{
				bool result = false;
				System.Collections.IEnumerator tempEnumerator = new System.Collections.ArrayList(collection).GetEnumerator();
				while (tempEnumerator.MoveNext())
					if (!(result = this.Contains(tempEnumerator.Current)))
						break;
				return result;
			}
开发者ID:nickchal,项目名称:pash,代码行数:14,代码来源:SupportClass.cs

示例11: AddAll

			/// <summary>
			/// Adds all the elements contained in the specified collection.
			/// </summary>
			/// <param name="collection">The collection used to extract the elements that will be added.</param>
			/// <returns>Returns true if all the elements were successfuly added. Otherwise returns false.</returns>
			public virtual bool AddAll(System.Collections.ICollection collection)
			{
				bool result = false;
				if (collection!=null)
				{
					System.Collections.IEnumerator tempEnumerator = new System.Collections.ArrayList(collection).GetEnumerator();
					while (tempEnumerator.MoveNext())
					{
						if (tempEnumerator.Current != null)
							result = this.Add(tempEnumerator.Current);
					}
				}
				return result;
			}
开发者ID:nickchal,项目名称:pash,代码行数:19,代码来源:SupportClass.cs

示例12: RemoveAll

 /// <summary>
 /// Removes all the elements contained into the specified collection.
 /// </summary>
 /// <param name="collection">The collection used to extract the elements that will be removed.</param>
 /// <returns>Returns true if all the elements were successfuly removed. Otherwise returns false.</returns>
 public virtual bool RemoveAll(ICollection collection)
 {
     bool result = false;
     IEnumerator tempEnumerator = new ArrayList(collection).GetEnumerator();
     while (tempEnumerator.MoveNext())
     {
         result = true;
         if (base.Contains(tempEnumerator.Current))
             base.Remove(tempEnumerator.Current);
     }
     return result;
 }
开发者ID:spib,项目名称:nhcontrib,代码行数:17,代码来源:SupportClass.cs

示例13: RetainAll

 public static bool RetainAll(ICollection target, ICollection c)
 {
     IEnumerator enumerator = new ArrayList(target).GetEnumerator();
     ArrayList list = new ArrayList(c);
     try
     {
         MethodInfo method = c.GetType().GetMethod("retainAll");
         if (method != null)
         {
             method.Invoke(target, new object[] { c });
         }
         else
         {
             method = c.GetType().GetMethod("Remove");
             while (enumerator.MoveNext())
             {
                 if (!list.Contains(enumerator.Current))
                 {
                     method.Invoke(target, new object[] { enumerator.Current });
                 }
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
     return true;
 }
开发者ID:89sos98,项目名称:TradingApi.Client.CS,代码行数:29,代码来源:CollectionsSupport.cs

示例14: ChangeSessionIdentifier

        /// <summary> Invalidate the old session after copying all of its contents to a newly created session with a new session id.
        /// Note that this is different from logging out and creating a new session identifier that does not contain the
        /// existing session contents. Care should be taken to use this only when the existing session does not contain
        /// hazardous contents.
        /// 
        /// </summary>
        /// <returns> The invaldiated session.
        /// </returns>   
        /// <seealso cref="Owasp.Esapi.Interfaces.IHttpUtilities.ChangeSessionIdentifier()">
        /// </seealso>
        public IHttpSession ChangeSessionIdentifier()
        {
            IHttpRequest request = ((Authenticator) Esapi.Authenticator()).CurrentRequest;
            IHttpResponse response = ((Authenticator) Esapi.Authenticator()).CurrentResponse;
            IHttpSession session = ((Authenticator)Esapi.Authenticator()).CurrentSession;
            IDictionary temp = new Hashtable();

            // make a copy of the session content
            IEnumerator e = session.GetEnumerator();
            while (e != null && e.MoveNext())
            {
                string name = (string) e.Current;
                object val = session[name];
                temp[name] = val;
            }

            // invalidate the old session and create a new one

            // This hack comes from here: http://support.microsoft.com/?kbid=899918
            session.Abandon();
            response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", ""));

            // copy back the session content
            IEnumerator i = new ArrayList(temp).GetEnumerator();
            while (i.MoveNext())
            {
                DictionaryEntry entry = (DictionaryEntry) i.Current;
                session.Add((string) entry.Key, entry.Value);
            }
            return session;
        }
开发者ID:Effzz,项目名称:owasp-esapi-classicasp,代码行数:41,代码来源:HttpUtilities.cs


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