示例#1
0
        //param   (StockList)listToMerge : second list to be merged
        //summary      : merge two different list into a single result list
        //return       : merged list
        //return type  : StockList
        public StockList MergeList(StockList listToMerge)
        {
            StockList resultList       = new StockList();
            StockList currentStockList = this;

            StockNode current     = this.head;
            StockNode nodeToMerge = listToMerge.head;


            while (nodeToMerge != null)
            {
                currentStockList.AddStock(nodeToMerge.StockHolding);

                nodeToMerge = nodeToMerge.Next;
            }

            currentStockList.SortByName();

            resultList = currentStockList;

            return(resultList);
        }