I am trying to initialize a generic collection List something like this:
List<MyCustomClass> myCustomClassList = new List<MyCustomClass>() {myCustomClassInstance1, myCustomClassInstance2};
I am getting the compile error "; expected". I don't understand this. Shouldn't I just be able to initialize this collection like this?
What version of .NET are you using? Collection initializers only work in .NET 3.5 and higher