Needs support for Extension Methods


With .NET 3.0 and up, .NET has method extensions. With this a method can be added onto an existing class (like an Int32). I want the extended methods to be accessible to the FLEE expression elements. The following example illustrates:
// An extension method for an int that determines how many numbers compose the integer if it was represented as a string.
static class IntExtension
public static int Length(this int i)
if (i <= 0) throw new ArgumentOutOfRangeException();
return (int)Math.Floor(Math.Log10(i)) + 1;
// Test for it.
// 3.Length() == 1
// 462.Length() == 3
Also see: http://www.extensionmethod.net/ for more examples of extension methods.


PistolPete wrote May 27, 2010 at 8:34 PM

Hi I'm not the project owner, but I don't think its possible to do that because extension methods are only used by the compiler and they are converted to static method calls in IL. There a compiler feature and not a langauge feature so they don't exist anymore after compiling...

wrote Feb 21, 2013 at 11:54 PM

zit35501 wrote Nov 25, 2015 at 10:35 AM


I needed that feature also in my project, if someone wants it I have put my version to github: https://github.com/ThomasZitzler/flee

Seems to work.

I do not really check if the first paramter of the static method is really marked with the "this" keyword. I just enhanced the checks so that FLEE also accepts static methods with the current context object as first parameter (all thos have to be registered to the context!).

IL generation is actually same as for member calls.