Use helper functions from DLL without initialization
Author: placebo76
Creation Date: 9/6/2015 11:21 AM
profile picture

placebo76

#1
Hi,

i have written my own Helper-Classes with additional functionalities and included it as a dll in my Wealtlab-Editor.

Now my question:

Is there another kind of using it without initialize it in any script like:

CODE:
Please log in to see this code.


It would be nice to use my helper functions like any other WealthLab / WealthScript - functions.

I'm not a programming expert ...

profile picture

Eugene

#2
Hi,

Classes and methods can be defined as static, freeing from the need to instantiate them. Keep in mind that this is not universally applicable because reduces flexibility:

Class with single method — best approach?
Static

The closest thing to what you're looking for is a kind of static method called "extension method" which became popular with advance of LINQ:

MSDN

Using extension methods, you no longer need to add "using Helper" and/or instantiate its classes.
profile picture

placebo76

#3
Thanks it works
profile picture

Eugene

#4
Nice collection of extension methods:

http://www.extensionmethod.net/csharp/