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


C# ArrayList.Clone方法代码示例

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


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

示例1: Gfa

        public Gfa(ArrayList X, int S, int S0, ArrayList F, ArrayList[,] I)
        {
            setType(TYPE.Gfa);

            this.X = (ArrayList)X.Clone();
            if (!X.Contains(EPSILON))
                this.X.Add(EPSILON);

            this.Read = (ArrayList)X.Clone();
            this.S = S;
            this.S0 = S0;
            this.F = (ArrayList)F.Clone();
            InitI(I);
        }
开发者ID:sohaibafifi,项目名称:automata,代码行数:14,代码来源:Gfa.cs

示例2: Membership

		/// <summary>
		/// Constructor: Initialises with the specified initial members 
		/// </summary>
		/// <param name="initial_members">Initial members of the membership</param>
		public Membership(ArrayList initial_members)
		{
			members=new ArrayList();
			if(initial_members != null)
				members = (ArrayList)initial_members.Clone();
			members = ArrayList.Synchronized(members);
		}
开发者ID:javithalion,项目名称:NCache,代码行数:11,代码来源:Membership.cs

示例3: filterExceptions

        public void filterExceptions(int filterLength)
        {
            ArrayList cleanedWhiteList = new ArrayList();
            for (int i = 0; i < WhiteList.Count; i++)
            {
                bool contained = false;
                String exception = WhiteList[i].ToString();

                if (exception.Length > filterLength)
                {
                    exception = exception.Substring(0, filterLength);
                }

                for (int x = 0; x < cleanedWhiteList.Count; x++)
                {
                    if (cleanedWhiteList[x].ToString().StartsWith(exception))
                    {
                        contained = true;
                    }
                }
                if (!contained)
                {
                    cleanedWhiteList.Add(WhiteList[i]);
                }
            }
            WhiteList = (ArrayList)cleanedWhiteList.Clone();
            cleanedWhiteList.Clear();
            cleanedWhiteList = null;
        }
开发者ID:CaptainMuscles,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:29,代码来源:DataRegister.cs

示例4: BusinessChange_Load

        private void BusinessChange_Load(object sender, EventArgs e)
        {
            beList = (ArrayList)this.Tag;
            origin=(ArrayList)beList.Clone();
            user = ((BusinessEmployee)beList[0]).EmployeeId;
            dept = user.Kdid;
            business = ((BusinessEmployee)beList[0]).BusinessId;

            foreach (BusinessEmployee be in beList)
            {
                ListViewItem item = new ListViewItem();
                item.Text = be.EmployeeId.KuName;
                item.Tag = be;
                listView1.Items.Add(item);
            }

            IList udList=getUserByDept(dept);
            foreach (WkTUser ud in udList)
            {
                ListViewItem item = new ListViewItem();
                item.Text = ud.KuName;
                item.Tag = ud;
                listView2.Items.Add(item);
            }
        }
开发者ID:zimengyu1992,项目名称:WorkLogForm,代码行数:25,代码来源:BusinessChange.cs

示例5: ThreadFunc

        private void ThreadFunc()
        {
            ArrayList sockets = new ArrayList(2);
            sockets.Add(mClientSocket);
            sockets.Add(mServerSocket);

            while (mRunning)
            {
                IList readsockets = (IList)sockets.Clone();
                Socket.Select(readsockets, null, null, 1000000);
                foreach (Socket s in readsockets)
                {
                    int length = 0;
                    try
                    {
                        length = s.Receive(mBuffer);
                    } catch { }
                    if (length == 0)
                    {
                        mRunning = false;
                        if (ProxyDisconnected != null) ProxyDisconnected(this);
                        break;
                    }
                    Socket dest = (s == mServerSocket) ? mClientSocket : mServerSocket;
                    dest.Send(mBuffer, length, SocketFlags.None);
                }
            }
        }
开发者ID:V07D,项目名称:wc3proxy,代码行数:28,代码来源:TcpProxy.cs

示例6: PivotCommand

 public PivotCommand(ArrayList objects, float X, float Y, float Z)
 {
     this.objects =(ArrayList)objects.Clone();
     this.X = X;
     this.Y = Y;
     this.Z = Z;
     pivotPoints = new ArrayList();
 }
开发者ID:deobald,项目名称:midget,代码行数:8,代码来源:TransformationCommands.cs

示例7: BinaryPriorityQueue

		protected BinaryPriorityQueue(ArrayList Core, IComparer Comp, bool Copy)
		{
			if(Copy)
				InnerList = Core.Clone() as ArrayList;
			else
				InnerList = Core;
			Comparer = Comp;
		}
开发者ID:javithalion,项目名称:NCache,代码行数:8,代码来源:BinaryPriorityQueue.cs

示例8: TestGetItems

        public void TestGetItems()
        {
            //--------------------------------------------------------------------------
            // Variable definitions.
            //--------------------------------------------------------------------------
            ArrayList arrList = null;
            //
            // Construct array list.
            //
            arrList = new ArrayList();

            // Add items to the lists.
            for (int ii = 0; ii < strHeroes.Length; ++ii)
            {
                arrList.Add(strHeroes[ii]);
            }

            // Verify items added to list.
            Assert.Equal(strHeroes.Length, arrList.Count);

            //Adapter, GetRange, Synchronized, ReadOnly returns a slightly different version of 
            //BinarySearch, Following variable cotains each one of these types of array lists

            ArrayList[] arrayListTypes = {
                                        (ArrayList)arrList.Clone(),
                                        (ArrayList)ArrayList.Adapter(arrList).Clone(),
                                        (ArrayList)ArrayList.FixedSize(arrList).Clone(),
                                        (ArrayList)ArrayList.ReadOnly(arrList).Clone(),
                                        (ArrayList)arrList.GetRange(0, arrList.Count).Clone(),
                                        (ArrayList)ArrayList.Synchronized(arrList).Clone()};

            foreach (ArrayList arrayListType in arrayListTypes)
            {
                arrList = arrayListType;
                //
                // []  Verify get method.
                //
                // Search and verify selected items.
                for (int ii = 0; ii < strHeroes.Length; ++ii)
                {
                    // Verify get.
                    Assert.Equal(0, ((string)arrList[ii]).CompareTo(strHeroes[ii]));
                }

                //
                // []  Invalid Index.
                //
                Assert.Throws<ArgumentOutOfRangeException>(() =>
                {
                    string str = (string)arrList[(int)arrList.Count];
                });

                Assert.Throws<ArgumentOutOfRangeException>(() =>
                {
                    string str = (string)arrList[-1];
                });
            }
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:58,代码来源:PropertyItemTests.cs

示例9: Grammer

 /// <summary>
 /// initialisation de la grammaire
 /// </summary>
 /// <param name="X">l'alphabet</param>
 /// <param name="V">les variables</param>
 /// <param name="S">l'axiome</param>
 public Grammer(ArrayList X, ArrayList V, char S)
 {
     this.X = (ArrayList)X.Clone();
     this.V = V;
     this.S = S;
     this.P = new ArrayList[V.Count];
     for (int i = 0; i < V.Count; i++)
         P[i] = new ArrayList();
 }
开发者ID:sohaibafifi,项目名称:automata,代码行数:15,代码来源:Grammer.cs

示例10: PGfa

 public PGfa(ArrayList X, int S)
 {
     setType(TYPE.PGfa);
     if (!X.Contains(EPSILON))
         this.X.Add(EPSILON);
     this.X = (ArrayList)X.Clone();
     this.S = S;
     InitI();
 }
开发者ID:sohaibafifi,项目名称:automata,代码行数:9,代码来源:PGfa.cs

示例11: DataAffinity

 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="groups"></param>
 /// <param name="strict"></param>
 public DataAffinity(ArrayList groups, bool strict)
 {
     if (groups != null)
     {
         _groups = (ArrayList) groups.Clone();
         _groups.Sort();
     }
     _strict = strict;
 }
开发者ID:javithalion,项目名称:NCache,代码行数:14,代码来源:DataAffinity.cs

示例12: Recombine

        public ArrayList Recombine(ArrayList maleGenes, ArrayList femaleGenes)
        {
            ArrayList Child = maleGenes.Clone() as ArrayList;

            bool usingMale = true;
            for (int i = 0; i < maleGenes.Count; i++)
            {
                Child[i] = usingMale ? ((IGene)maleGenes[i]).Clone() : Child[i] = ((IGene)femaleGenes[i]).Clone();
                if (i % GenesPerCrossover == 0) usingMale = !usingMale;
            }

            return Child;
        }
开发者ID:BRP1984,项目名称:Genetic-Algorithms,代码行数:13,代码来源:UniformMultiPointCrossoverRecombinator.cs

示例13: EqualsCollection

		public void EqualsCollection()
		{
			ArrayList value1 = new ArrayList();
			value1.Add(10);
			value1.Add(20);

			ArrayList value2 = (ArrayList) value1.Clone();

			TypedValue t1 = new TypedValue(NHibernateUtil.Int32, value1, EntityMode.Poco);
			TypedValue t2 = new TypedValue(NHibernateUtil.Int32, value2, EntityMode.Poco);

			Assert.IsTrue(t1.Equals(t2));
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:13,代码来源:TypedValueFixture.cs

示例14: RArray

 public RArray(NetRuby rb, ArrayList a, bool clone) :
     base(rb, rb.cArray)
 {
     if (clone)
     {
         // but it creates only a shallow copy.
         ptr = (ArrayList)a.Clone();
     }
     else
     {
         ptr = a;
     }
 }
开发者ID:emtees,项目名称:old-code,代码行数:13,代码来源:Array.cs

示例15: ItemsNotInCache

        /**
           * Takes an array of items and returns an new array of any that are
           * NOT currently in cache.
           */
        public ArrayList ItemsNotInCache(ArrayList items)
        {
            // First build a list of "new" items to add to cache
            if (!HasDataFromServer) {
                return items.Clone () as ArrayList;
            }

            var batch = new ArrayList ();
            for (int i=0; i<items.Count; i++)
                if (!Has ((items [i] as string)))
                    batch.Add (items [i]);

            return batch;
        }
开发者ID:yorrickm,项目名称:sdk-unity,代码行数:18,代码来源:ItemCache.cs


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