Yurttas/PL/OOL/CS/F/05/03/01/ArrayList01.cs

From ZCubes Wiki
Revision as of 08:09, 7 November 2013 by MassBot1 (talk | contribs) (Created page with "<syntaxhighlight lang="csharp" line start="1" enclose="div">/** * Copyright(C) 2003 * All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc.. * * ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
 1/**
 2 *  Copyright(C) 2003
 3 *  All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4 *
 5 *  Permission to use, copy, modify, and distribute this
 6 *  software and its documentation for EDUCATIONAL purposes
 7 *  and without fee is hereby granted provided that this
 8 *  copyright notice appears in all copies.
 9 *
10 *  @date   : September 1, 2003
11 *  @author : Salih Yurttas
12 *
13 *  ArrayList01.cs
14 */
15
16
17using System;
18using System.Collections;
19
20namespace ArrayList01
21{
22
23  public class AL10
24  {
25    public static void Main(string[] args)
26    {
27      ArrayList AList = new ArrayList();
28
29      AList.Add("cat");
30      AList.Add("elephant");
31
32      int n = AList.Count;
33      for(int i=0; i<n; ++i)
34        System.Console.WriteLine("{0}", AList[i]);
35
36      System.Console.WriteLine();
37
38      foreach(string s in AList)
39        System.Console.WriteLine("{0}", s);
40
41      System.Console.WriteLine();
42
43      ArrayList AAList = new ArrayList(new ArrayList());
44
45      AAList.Add(new ArrayList(AList));
46
47      AList.Clear();
48
49      AList.Add("lion");
50      AList.Add("tiger");
51      AList.Add("dog");
52
53      foreach(string s in AList)
54        System.Console.WriteLine("{0}", s);
55
56      System.Console.WriteLine();
57
58      AAList.Add(new ArrayList(AList));
59
60      foreach(ArrayList AL in AAList){
61        foreach(string s in AL)
62          System.Console.WriteLine("{0}", s);
63        System.Console.WriteLine();
64      }
65    }
66  }
67
68}