Create/Initialize a List of controls one time in static class
Should I do this in a static Ctor? Else if the Create method is public static everyone 开发者_StackOverflow社区could call it and recreate the List of controls. That is not wanted!
In my public Get I would just check if my list of objects is empty and create it there before return it back to the caller. Don't forget to lock
this part of code, to insure that only the first call on your empty list does the create.
I don't know exactly what you intend to do (your question is pretty vague), but if you want to make sure your initialization is executed once and only once before any call to any member of your class, the static constructor is the place to go.
精彩评论