main
1using System.Collections;
2using System.Collections.Generic;
3
4namespace mars.rover.common
5{
6 public class DefaultRegistry<T> : Registry<T>
7 {
8 readonly IList<T> items;
9
10 public DefaultRegistry(params T[] items)
11 {
12 this.items = new List<T>(items);
13 }
14
15 public void Add(T item)
16 {
17 items.Add(item);
18 }
19
20 public IEnumerable<T> all()
21 {
22 return items;
23 }
24
25 public IEnumerator<T> GetEnumerator()
26 {
27 return all().GetEnumerator();
28 }
29
30 IEnumerator IEnumerable.GetEnumerator()
31 {
32 return GetEnumerator();
33 }
34 }
35}