Print within c# class

Hi all,

I am trying to use Print(msg) within a class in c# component and got this message - Error (CS0038): Cannot access a non-static member of outer type ‘Script_Instance’ via nested type ‘Script_Instance.Island’ (line 206). Any idea?

Thanks in advance.


Where do you want to print? To out param or to Rhino command window? I’m guessing that the second is the case and you should use one of those Rhino.RhinoApp.WriteLine()

Thanks Przemysław,

I meant to the output. Any thought?


Sure. You need to perform it on Script_Instance object as it’s not a static method take a look below

Don’t know for what you need it but if you want to use it often then pass it in constructor and make backing field in class - it will be easier to use it. Otherwise if in one method only just make place for object of script in method call params.

Hope this helps :wink:

1 Like

Lovely! This was exactly what i was looking for!



Cool! You can also mark as solved :wink: