I have a class that I fill from the database:
public class Option<T>
{
public T Value { get; set; }
public T DefaultValue { get; set; }
public List<T> AvailableValues { get; set; }
}
I want to have a collection of them:
List<Option<T>> list = new List<Option<T>>();
Option<bool> TestBool = new Option<bool>();
TestBool.Value = true;
TestBool.DefaultValue = false;
list.Add(TestBool);
Option<int> TestInt = new Option<int>();
TestInt.Value = 1;
TestInt.DefaultValue = 0;
list.Add(TestInt);
It doesn't seem to work. Ideas?