J
Jon Davis
Two options:
1. Inheritance
2. Static methods
Jon
1. Inheritance
2. Static methods
Jon
Thanks William.William Ryan said:If you are using VB.NET, then declare your methods/properties as Shared. If
you are using C#, then declare them as Static
Well, maybe you mean this: in codebehind class add the following:ll said:Hi,
How to make a common function so other pages can call directly?
Thanks.
Ron McNulty said:In my opinion, static functions and especially variables are to be kept for
very occasional use.
Ron said:Hi Bill
Blimey, many more posts along those lines and you may get banned from the
newsgroup
Seriously though, my experience with static variables in particular has been
that they can become a right pain in the nether regions. As an example, we
had a Java system that was full of such variables. It worked great until we
realised that we needed to run multiple instances of the application on one
machine. Under Java (and probably .NET) this is a very resource-heavy unless
the instances run inside the same virtual machine. So we tried to do this,
but static variables prevented it - there was now only one copy of the
variable over n applications, rather than one copy per application instance.
I'm not so down on static functions, as they certainly have their place. But
they are often overused, and the method can often just be a member of the
class.
e.g A static method Widget.MungeWidget(Widget w, int count) could be
replaced with a member method Munge(int count) with an increase in clarity.
Re connection strings etc, these go in the App.config file in C#, and are
available globally via calls on the Application class (if my memory is
correct).
Regards
Ron
Ron McNulty said:Blimey, many more posts along those lines and you may get banned from the
newsgroup
Seriously though, my experience with static variables in particular has been
that they can become a right pain in the nether regions. As an example, we
had a Java system that was full of such variables. It worked great until we
realised that we needed to run multiple instances of the application on one
machine. Under Java (and probably .NET) this is a very resource-heavy unless
the instances run inside the same virtual machine. So we tried to do this,
but static variables prevented it - there was now only one copy of the
variable over n applications, rather than one copy per application instance.
Dmitry Baibakov said:By the way, is it really so that several JVM's share static members? I
think it could be this way.