|
-
Sep 28th, 2010, 06:49 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] Initialization check
Hi,
So I have this static class with a couple of static functions.
This class, though, needs to be initialized first by loading some data.
Figured I could use a static boolean called init and throw an exception in each function if init is not true.
This would require me to do a check in every function.
It's doable, but is there a more efficient way to do this?
Thanks
Delete it. They just clutter threads anyway.
-
Sep 28th, 2010, 08:38 AM
#2
Re: Initialization check
Is there a genuine reason that this class is static? It sounds like it would make sense to require the user to create an instance by passing this required data to the constructor.
-
Sep 28th, 2010, 12:27 PM
#3
Thread Starter
Frenzied Member
Re: Initialization check
It's a settings container and initially that's the way I designed it (not static).
But as it's built only to load one set of settings and it's easier to access statically, I figured, why not?
Last edited by TheBigB; Sep 28th, 2010 at 02:06 PM.
Delete it. They just clutter threads anyway.
-
Sep 28th, 2010, 06:12 PM
#4
Re: Initialization check
 Originally Posted by TheBigB
I figured, why not?
I guess this thread is the answer to that question.
-
Sep 29th, 2010, 02:40 AM
#5
Thread Starter
Frenzied Member
Re: Initialization check
I guess I'm gonna be stubborn and do some copying and pasting.
I'd rather code using Settings.Function than Program.Settings.Function.
God, I'm lazy 
Was just wondering if there was an easier way.
Thanks
Delete it. They just clutter threads anyway.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|