"My Extensions"
There should be a way to write and maintain a set of extension methods that would be made available to all query windows in LINQPad.
This is now complete. Go to “My Queries” and click the “My Extensions” query.
-
Matthew commented
Isn't this done now with the new beta ? Since you can drop a plugin assembly in a folder and have it available to all queries........ ?
-
Bent Rasmussen commented
I urge you to consider this instead:
It is more general in that you can factor out any linqcode and reuse it, not just extensions...
Extension methods are useful, but so are other types: classes, enums, etc. - and the extension methods belonging to these -- and once you develop a lot in linqpad you will see the need for this -- sooner or later you'll hit the wall with this need
-
Bent Rasmussen commented
Extension methods mostly work it seems, but I do get warnings about extension class not being nested classes. It would also ne nice to have partial queries: i.e. set a standard partial query class; then you can define extensions etc. in that; but as long as extensions are working I don't need that. I would like to have the warnings removed tho...
-
Schuster-Rainer commented
have a look at http://linqpad.uservoice.com/forums/18302-linqpad-feature-suggestions/suggestions/453843-support-mef-managed-extensibility-framework-base too. Enabling LINQ to be MEF yfied we could get a much richer community to develop additional features...
-
Thomas Levesque commented
OK, I just read about it in the version history. Thanks !
-
Thomas Levesque commented
@Joe, how ? The UserQuery class is not static, so it's not allowed to contain extensions methods. It gives an error: "Extension method must be defined in a non-generic static class".
I have the latest stable version. Do I have to get the beta ?
-
Thomas - you can write extension methods in LINQPad - this was fixed some versions ago.
-
Thomas Levesque commented
Great idea, I always bitch at not being able to write extension methods in LINQPad... In addition to the "My Extensions" feature, it would be nice to have an option to make the UserQuery class static, so we can write extension methods in any .linq file
-
Dan Puza commented
The way I do this currently is that I have one Class Library project in Visual Studio, exactly for this purpose. I've added that project's output to my default references and namespace imports. Then I add any extension methods or classes there. So then they are available in any new LINQPad query window. I understand that you're looking for something even easier and more integrated. But for me, this is easy enough and works great.