示例#1
0
        private void btClone_Click(object sender, System.EventArgs e)
        {
            SwimData newSd = (SwimData)swdata.Clone();

            newSd.sort();
            while (newSd.hasMoreElements())
            {
                Swimmer sw = (Swimmer)newSd.getSwimmer();
                lsNewKids.Items.Add(sw.getName());
            }
        }
        //-----
        public object Clone()
        {
            //create a new ArrayList
            ArrayList swd = new ArrayList();

            //copy in swimmer objects
            for (int i = 0; i < swdata.Count; i++)
            {
                swd.Add(swdata[i]);
            }
            //create new SwimData object with this array
            SwimData newsd = new SwimData(swd);

            return(newsd);
        }
示例#3
0
 private void init()
 {
     swdata = new SwimData("swimmers.txt");
     reload();
 }
        //-----
        public object Clone()
        {
            SwimData newsd = new SwimData(swdata);

            return(newsd);
        }