How can I create .Net extension methods by C++/CLI?
问题 In C#, extension methods can be created by public static class MyExtensions { public static ReturnType MyExt(this ExtType ext) { ... } } Since all of my library are written in C++/CLI, I would like to create the .net extension methods also in C++/CLI (in order to have one DLL instead of two). I've tried the following code static public ref class MyExtensions { public: static ReturnType^ MyExt(this ExtType ^ext) { ... } }; But the compiler can not recognize keyword 'this' in the first argument