Exemple #1
0
 static void PrintList <T>(ListTest <T> list)
 {
     foreach (T item in list)
     {
         Console.WriteLine(item);
     }
 }
Exemple #2
0
            public bool MoveNext()
            {
                if (list == null)
                {
                    return(false);
                }

                Current = list.value;
                list    = list.next;
                return(true);
            }
Exemple #3
0
 public void Add(T value)
 {
     if (_current == null)
     {
         next     = new ListTest <T>(value);
         _current = next;
     }
     else
     {
         _current.next = new ListTest <T>(value);
         _current      = _current.next;
     }
 }
Exemple #4
0
        public static void Main(string[] args)
        {
            ListTest <int> list = new ListTest <int>(10);

            for (int i = 20; i <= 150; i += 10)
            {
                list.Add(i);
            }
            ListTest <double> list2 = new ListTest <double>(10);

            for (double i = 0.1; i <= 10; i += 0.15)
            {
                list2.Add(i);
            }
            PrintList(list);
            PrintList(list2);
        }
Exemple #5
0
 public void Reset()
 {
     list = null;
 }
Exemple #6
0
 public Enumerator(ListTest <T> list)
 {
     this.list = list;
 }