What I'm trying to have is a 2D global list initialized with strings.
If I only wanted a simple list I could just initialize the list with strings separated by a comma like this
public static readonly List<string> _architecturesName = new List<string>() {"x86","x64" };
I have set up a static class Globals
, in this class I'm adding a List based on another class ArchitecturesClass
to be used as fields for the list similar to what was done here
public class ArchecturesClass
{
public string Id { get; set; }
public string Name { get; set; }
}
// test1 :
public static readonly List<ArchecturesClass> ArchitectureList = new List<ArchecturesClass>() { "2", "9"};
// test2 :
public static readonly List<ArchecturesClass> ArchitectureList = new List<ArchecturesClass>()
{
architecturesId = "2",
architecturesName = "3"
};
The error on the strings is that the collection initialize has some invalid arguments and
In the end, I want all classes in the project to be able to read something like Globals.ArchtecutreList.ID and a matching Globals.ArchtecutreList.Name;
and I would like to initialize this in the global class without being in a method.