I want to ensure that my List can contain only 2 elements array of int. I am currently have to declare a struct but I really don't want to declare many type if it is not really necessary. So I am wondering if I can declare a list of fixed size array.
static void Main(string[] args)
{
//I want to declare something like this
List<int[2]> list = new List<int[2]>();
list.Add(new int[2] { 1, 2 });
list.Add(new int[2] { 3, 4 });
//What I having to do(not really want because I have to declare struct)
List<TwoElement> list2 = new List<TwoElement>();
list2.Add(new TwoElement() { Element1 = 1, Element2 = 2 });
list2.Add(new TwoElement() { Element1 = 1, Element2 = 2 });
}
private struct TwoElement
{
public int Element1;
public int Element2;
}