How to define an extension method in a scriptcs csx script

前端 未结 3 668
逝去的感伤
逝去的感伤 2021-01-01 16:38

I\'m playing with ScriptCS (which is awesome!) but I couldn\'t figure out how to define an extension method within a .csx script file.

Take this e

3条回答
  •  难免孤独
    2021-01-01 17:26

    Unfortunately, because compiling something on the fly requires a class, scriptcs was designed to take the raw code that mattered and wrap it in a class. You would need to modify a version of scriptcs for your needs -or consider contributing to the project.

    However, I too love scriptcs and think it's one of the most fantastic projects out there today!

    I too tried this early on when using scriptcs and my heart broke when it didn't work. If I had more bandwidth I'd contribute this addition on my own.

    AFAIK this is not a limitation with Roslyn.

提交回复
热议问题