Use static methods.
E.g.
class SomeClass {
public static MyResultType MyFunc(...) {
....
}
}
It could be called from anywehere in assembly subject to visibility rules as
MyResultType result=SomeClass.MyFunc(...);
No need to instantiate SomeClass.
Check static modifier and related articles in MSDN
HTH
Alex
"Maziar Aflatoun" <ma***@rogers.com> wrote in message
news:RU********************@twister01.bloor.is.net .cable.rogers.com...
Hi,
Is there way in C# (or C#.net) to just define a function without having to
initialize the class every time. For instance a function that takes a
number, adds 2 and multiplies by 10. I know how to do it in a class. But
the problem with classes is that it has to be instantiated every time.
So for example in my code I want to be able to just call
xx = myfunctionname(2);
Thank you
Maziar A.