FastExpressionCompiler icon indicating copy to clipboard operation
FastExpressionCompiler copied to clipboard

Possible improvements if ever migration to C# 7.X+(7.3+ to be specific)

Open dzmitry-lahoda opened this issue 7 years ago • 2 comments

Now:

        public static TDelegate TryCompile<TDelegate>(this LambdaExpression lambdaExpr)
            where TDelegate : class =>

With C# 7.3 could be

        public static TDelegate TryCompile<TDelegate>(this LambdaExpression lambdaExpr)
            where TDelegate : System.Delegate =>

https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/where-generic-type-constraint

I got into it when tried to use Delegate return parameter for some internal checks. E.g. more strictly typed Console.WriteLine(typeof(Action).GetMethod("Invoke").ReturnType); and better user documentation (also all knows that should pass delegate, but for most entry coders - still may be good).

dzmitry-lahoda avatar Aug 10 '18 07:08 dzmitry-lahoda

Need to wait for Travis will update

CSC : error CS1617: Invalid option '7.3' for /langversion; must be ISO-1, ISO-2, Default, Latest or a valid version in range 1 to 7.1. [/Users/travis/build/dadhi/FastExpressionCompiler/test/FastExpressionCompiler.IssueTests/FastExpressionCompiler.IssueTests.csproj]

dzmitry-lahoda avatar Aug 10 '18 10:08 dzmitry-lahoda

May do GC free copy free programming with

https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/in-parameter-modifier and other ref improvements

dzmitry-lahoda avatar Aug 10 '18 10:08 dzmitry-lahoda

outdated, implemented? ;)

dadhi avatar Aug 20 '23 10:08 dadhi