Tech Off Post

Single Post Permalink

View Thread: Static initializers and reflection
  • User profile image
    BitFlipper

    @Dexter:

    In my case the number of static fields will be minimal so I don't think it should be a problem to just call them all.

    Although, this lazy initialization... How would that work in cases like this:

    private static DateTime initTime =  DateTime.Now;

    ...or cases where the static field is something that does real work, like a class that creates a file in its constructor, etc? Some other class instance might need to use that file. A bit of a contrived example, but still...