Is it possible to use extension method?

Apr 9, 2014 at 5:02 PM
Is it possible to use extension method with the global namespace (LuaGlobal)
cf. Extension Methods (C# Programming Guide)

For example
static class Program
{
   public static string get_value(this string sElement, string sValue) { return string.Format("{0} get_value = {1}", sElement, sValue); }

   public static void Main(string[] args)
   {
            string sTest = "Test NeoLua";
            Console.WriteLine(sTest.get_value("XXX"));
   }
}
Output :
Test NeoLua get_value = XXX
Coordinator
Apr 9, 2014 at 7:14 PM
The parser/binder does not search for extension methods, because it is to intensive. It take a lot time to scan all classes of the framework for the correct extensions. It might will go into secounds.

But you can still call the methods as a normal static method. Like: clr.Program:get_value('Element', 'Value');

Currently, I also have no idea, how to introduce this feature.