D.Bot <De****@riset.nu> wrote:
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.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too