2 using System
.Collections
;
3 using System
.Collections
.Generic
;
7 public static int Main ()
9 Int32Collection src
= new Int32Collection ();
10 Int32Collection dest
= new Int32Collection ();
16 ReplaceContentsWith
<Int32Collection
> (src
, dest
);
28 private static void ReplaceContentsWith
<T
> (T src
, T dst
)
29 where T
: Int32Collection
32 foreach (int value in src
)
37 class Int32Collection
: IEnumerable
39 List
<int> list
= new List
<int> ();
43 get { return list.Count; }
46 public int this[int index
]
48 get { return (int) list[index]; }
49 set { list[index] = value; }
52 public void Add (int value)
62 IEnumerator IEnumerable
.GetEnumerator ()
64 return list
.GetEnumerator ();