Hello,
I have a generic collection class.
T type is not known at compile. I would like to be able to dinamically set it up at runtime. Is there a way to accomplish it nicely?Code:public class CustomTypeCollection<T>: ICustomTypeCollection<T>, IEnumerable<T> where T:class,ICustomType, new() { List<T> collection=new List<T>(); public CustomTypeCollection() { } public void Add(T item) { collection.Add(item); } public T Item(int index) { return collection[index]; } IEnumerator IEnumerable.GetEnumerator() { { return collection.GetEnumerator(); } } IEnumerator<T> IEnumerable<T>.GetEnumerator() { { return collection.GetEnumerator(); } }
Thank you,
Serge




Reply With Quote