RhinoCommon global variable best practice

Hi,

a short question about global variable best practice. If I have a plug-in with many commands, but I want to have one global variable accesible from anywhere and everywhere, where should I put it? In the MyProjectPlugIn.cs?

I guess in that case the variable should be initialized when the Plug-in is loaded (which is the desired behaviour) and persist throughout the entire session (until Rhino is closed) ?

For example, if I start Grasshopper and make some definitions…and then close the GH window and then reopen it, everything is still there… So the whole structure is kept somewhere in the background. I would like the same type of behaviour for my Plug-In…a certain structure to be kept and be independent of different commands that can be called and different windows that can be opened within the Plug-in.

Thanks,
Milos

Make a singleton class and store them there

gerry

1 Like