I want to initialize a static collection within my C# class - something like this:
public class Foo {
private static readonly ICollection<string> g_collection = ???
}
I'm not sure of the right way to do this; in Java I might do something like:
private static final Collection<String> g_collection = Arrays.asList("A", "B");
is there a similar construct in C# 2.0?
I know in later versions of C#/.NET you can do collection initializers (http://msdn.microsoft.com/en-us/library/bb384062.aspx), but migration isn't an option for our system at the moment.
To clarify my original question - I'm looking for a way to succinctly declare a simple static collection, such as a simple constant collection of strings. The static-initializer-style way is also really good to know for collections of more complex objects.
Thanks!