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


C# System.Collections.ArrayList.Clone方法代码示例

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


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

示例1: fireEvents

		public virtual void  fireEvents(int type, ArrayList listeners)
		{
			ArrayList targets = null;
			Listener l = null;
			
			lock(this)
			{
				if (listeners == null)
					return ;
				targets = (ArrayList) listeners.Clone();
			}
			
			if (targets != null)
				 for (int i = 0; i < targets.Count; i++)
				{
					l = (Listener) targets[i];
					fireEvent(type, l);
				}
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:19,代码来源:InputBufferEventSupport.cs

示例2: GetInventoryListBySQLID

        public System.Collections.ArrayList GetInventoryListBySQLID(int SqlID, System.Collections.ArrayList InventoryList)
        {
            System.Collections.ArrayList InventorySQLIDList = new System.Collections.ArrayList();

            foreach (inventory_item MyInventoryItem in InventoryList)
            {
                if (MyInventoryItem.SqlID == SqlID)
                {
                    InventorySQLIDList.Add(MyInventoryItem);
                }
            }

            return (System.Collections.ArrayList)InventorySQLIDList.Clone();
        }
开发者ID:bignall,项目名称:CS-ELBot,代码行数:14,代码来源:Inventory.cs

示例3: CreateObject

        protected override Object CreateObject(NonterminalToken token)
        {
            string name;
               int bytes, inx, value;
               CmdItem cmdItem;
               TestValue testval;
               try
               {
               switch (token.Rule.Id)
               {

                   case (int)RuleConstants.RULE_TESTGROUPEXPRESS_TESTEQ:
                       CanTest = false;
                       break;
                   case (int)RuleConstants.RULE_VERSION_VERSIONEQ_FLOAT:
                       this.version = token.Tokens[1].UserObject.ToString();
                       break;
                   case (int)RuleConstants.RULE_TESTGROUPEXPRESS_TESTEQ2:
                       CanTest = true;
                       break;
                   case (int)RuleConstants.RULE_TESTEXPRESS_ATCMD:
                       tmpTestExpress.Add(tmpTestValues);
                       tmpTestValues = new System.Collections.ArrayList(10);
                       break;
                   case (int)RuleConstants.RULE_TESTREPEATITEMS_LBRACE_RBRACE:

                       testval = (TestValue)token.Tokens[0].UserObject;
                       inx = tmpTestValues.IndexOf(testval);
                       for (int i = inx + 1; i < tmpTestValues.Count; i++)
                           testval.subValues.Add(tmpTestValues[i]);
                       for (int i = tmpTestValues.Count - 1; i > inx; i--)
                           tmpTestValues.RemoveAt(i);
                       break;
                   case (int)RuleConstants.RULE_TESTSELECTVALUE_NUMBER:

                       return token.Tokens[0].ToString();
                   case (int)RuleConstants.RULE_TESTSELECTVALUES:
                       return token.Tokens[0].UserObject;

                   case (int)RuleConstants.RULE_TESTSELECTITEM_IDENTIFIER_LPARAN_RPARAN:

                       name = token.Tokens[0].UserObject.ToString();
                       value = Convert.ToInt32(token.Tokens[2].UserObject.ToString());
                       tmpTestValues.Add(testval = new TestValue(name, value));
                       return testval;

                   case (int)RuleConstants.RULE_TESTITEM2:

                       return token.Tokens[0].UserObject;

                   case (int)RuleConstants.RULE_RANGEITEM_IDENTIFIER_LPARAN_RPARAN:
                       NonterminalToken ntok;
                       name = token.Tokens[getTokenInx(token, "Identifier")].UserObject.ToString();
                       ntok = findToken(token, "Bytes");
                       bytes = Convert.ToInt32(ntok.Tokens[0].UserObject.ToString());
                       ntok = findToken(token, "LValue");
                       int lval = Convert.ToInt32(ntok.Tokens[0].UserObject.ToString());
                       ntok = findToken(token, "HValue");
                       int hval = Convert.ToInt32(ntok.Tokens[0].UserObject.ToString());
                       TmpCmdItems.Add(cmdItem = new CmdItem(name, bytes, lval, hval));
                       return cmdItem;

                   case (int)RuleConstants.RULE_SELECTITEM_IDENTIFIER_LPARAN_RPARAN:
                       SelectValue[] selectvalues;
                       name = token.Tokens[0].UserObject.ToString();
                       bytes = Convert.ToInt32(findToken(token, "Bytes").Tokens[0].UserObject.ToString());
                       selectvalues = new SelectValue[TmpSelectValues.Count];
                       for (int i = 0; i < TmpSelectValues.Count; i++)
                       {
                           selectvalues[i] = (SelectValue)TmpSelectValues[i];
                       }
                       TmpCmdItems.Add(cmdItem = new CmdItem(name, bytes, selectvalues));
                       TmpSelectValues.Clear();
                       return cmdItem;

                   case (int)RuleConstants.RULE_SELECTVALUE_NUMBER:
                       SelectValue sVal = new SelectValue();
                       sVal.value = Convert.ToInt32(token.Tokens[0].UserObject.ToString());
                       sVal.valueName = findToken(token, "ValueDescription").Tokens[0].UserObject.ToString();
                       TmpSelectValues.Add(sVal);

                       break;
                   case (int)RuleConstants.RULE_EXPRESSITEM:
                       return token.Tokens[0].UserObject;

                   case (int)RuleConstants.RULE_REPEATEXPRESS_LBRACE_RBRACE:
                       inx = TmpCmdItems.IndexOf(token.Tokens[0].UserObject);
                       for (int i = inx + 1; i < TmpCmdItems.Count; i++)
                           ((CmdItem)TmpCmdItems[inx]).AddSubItems((CmdItem)TmpCmdItems[i]);//reduce repeat item
                       for (int i = TmpCmdItems.Count - 1; i > inx; i--)
                           TmpCmdItems.RemoveAt(i);
                       return TmpCmdItems[inx];
                   case (int)RuleConstants.RULE_SENDEXPRESS_SENDEQ:  //send express
                       tmpSendExpress.Clear();
                       break;
                   case (int)RuleConstants.RULE_SENDEXPRESS_SENDEQ2: //sendexpress
                       tmpSendExpress = (System.Collections.ArrayList)TmpCmdItems.Clone();
                       TmpCmdItems.Clear();
                       break;
                   case (int)RuleConstants.RULE_RETURNEXPRESS_RETURNEQ:
//.........这里部分代码省略.........
开发者ID:ufjl0683,项目名称:sshmc,代码行数:101,代码来源:Protocol.cs

示例4: GetindexofArrayfromassignmentStatement

        public ArrayList GetindexofArrayfromassignmentStatement(string statement)
        {
            ArrayList index = new ArrayList();
            ArrayList index1 = new ArrayList();
            ArrayList indextemp = new ArrayList();
            int i;
            bool flag=false,flagagain=false ;

            for (i = 0; i <= statement.Length -1; i++)
            {
                if (statement[i]=='[')
                {
                    flag = true;
                    i = i + 1;
                }
                if (statement[i] == ']')
                {
                    flag = false;
                    flagagain = true;
                }
                if (flag)
                {
                    index.Add(statement[i]);

                }
                if (flagagain)
                {
                    if (index1.Count < index.Count)
                    {

                        if (index.Count >= indextemp.Count)
                        {
                            index1 = (ArrayList)index.Clone();
                        }
                        else
                        {
                            index1 = (ArrayList)indextemp.Clone();
                        }
                    }
                    indextemp = (ArrayList)index.Clone();
                    index.Clear();
                    flagagain = false;
                }
            }

            return index1;
        }
开发者ID:prem30488,项目名称:C2CUDATranslator,代码行数:47,代码来源:Analysis.cs

示例5: refresh

		protected internal virtual void  refresh(ArrayList listeners)
		{
			ArrayList v;
			lock(listeners)
			{
				v = (ArrayList) listeners.Clone();
			}
			if (v != null)
				 for (int i = 0; i < v.Count; i++)
					((Listener) v[i]).refresh();
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:11,代码来源:InputBufferEventSupport.cs

示例6: fringeSearch

       /* Fringe Search 
        * Fringe search is a memory enchanced version of IDA* */
       public bool fringeSearch()
       {
           //initialize:
           System.Collections.ArrayList nowList = new System.Collections.ArrayList();
           System.Collections.ArrayList laterList = new System.Collections.ArrayList();
           System.Collections.ArrayList rejectedList = new System.Collections.ArrayList();
           int limit = calcHvalue(startNode);
           
           #if DEBUG
                Globals.l2net_home.Add_Debug("start limit:" + limit);
           #endif

           bool found = false;

           Globals.debugPath = nowList;
           nowList.Add(startNode);
           
           while (!found)
           {
              // Globals.l2net_home.Add_Debug("big loop...");
               
               int fmin = INFINITY;
               while (nowList.Count != 0)
               {
                   AstarNode head = ((AstarNode)nowList[0]);
                   head.fvalue = calcFvalue(head);
                   

                   #region check for goal
                   if (isNodeTarget(head, targetNode.x, targetNode.y))
                   {
                       found = true;
                       break;
                   }
                   #endregion

                   //check if head is over the limit
                   if (head.fvalue > limit)
                   {
                       
                       //transfer head from nowlist to laterlist.
                       nowList.Remove(head);
                       laterList.Add(head);

                       //find the minimum of the nodes we will look at 'later'
                       fmin = Util.MIN(fmin, head.fvalue);

                      
                   }           
                   else
                   {
                       #region expand head's children on to now list
                       expand(head); //nodes are sorted by insert sort in this function

                       bool addedChildren = false;
                       foreach (AstarNode child in head.adjacentNodes)
                       {
                           //dont allow children already on path or adjacent to path or walls...

                           if (!isNodeIn(nowList, child) && !isNodeIn(laterList, child) && !isNodeIn(rejectedList, child))
                           {
                               if (child.passable == true)
                               {
                                   //add child of head to front of nowlist 
                                   nowList.Insert(0, child);
                                   addedChildren = true;
                               }
                           }

                       }
                       if (!addedChildren)
                       {                        
                           nowList.Remove(head);
                           rejectedList.Add(head);

                       }
                       #endregion
                   }

               }
               if (found == true)
                   break;

               //set new limit
              // Globals.l2net_home.Add_Debug("new limit:" + fmin);
               limit = fmin;

               //set now list to later list.
               nowList = (System.Collections.ArrayList)laterList.Clone();
               nowList.Sort();
               Globals.debugPath = nowList;
               laterList.Clear();

           
           }

           if (found == true)
           {
//.........这里部分代码省略.........
开发者ID:stephenZh,项目名称:l2net,代码行数:101,代码来源:Astar.cs


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