1
Answer

Static Code Blocks?

Ask a question
I have a static Hashtable variable in a class that I would like to populate prior to any instance of the class being created. However, it seems like the earliest point at which I can populate the Hashtable is within the constructor.

I know Java allows a static code block...
static {
   // code here
}
...this allows for static code to occur prior to any object being created from the class. Is something like this possible in C#?? If not, does anyone have any suggestions on how to work around this?

Answers (1)