Really Newbe Question.

  • Thread starter Thread starter D.Bot
  • Start date Start date
D

D.Bot

How can i make myself an sort of datafile where I can put all my
Funtcions/Methodes/ etc.. for my whole application?

Many Thanks

D.Bot
 
I want methodes/functions/ etc.. that i use more then once in different
forms to be in 1 file.
for exampple:
I dont want n function that makes connection to my database to be
writen everytime I need it but just once
 
D.Bot said:
I want methodes/functions/ etc.. that i use more then once in different
forms to be in 1 file.
for exampple:
I dont want n function that makes connection to my database to be
writen everytime I need it but just once

It sounds like you're basically after utility classes (I'd suggest not
putting *everything* in one place - there's no need to group string
utility methods together with database utility methods, for instance).
These tend to be classes full of static methods, often with a private
constructor to prevent instantiation. (In C# 2.0 you can create static
classes which have no constructors whatsoever.)

I'd be a little wary when creating such classes though - often you find
you get a better design if you sit back and think for a while about
whether a "normal" class with instance methods would be a better
design, perhaps combined with a factory to create instances.
 
D.Bot said:
I want methodes/functions/ etc.. that i use more then once in different
forms to be in 1 file.
for exampple:
I dont want n function that makes connection to my database to be
writen everytime I need it but just once

group similar functions in new class and use instance of that class
 
Back
Top