From d1755878470e59de78608ac4669bc6ccaf656b76 Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Sun, 5 Jan 2020 22:51:03 -0600 Subject: [PATCH] Added optimization for trailing assignment in .NET 3 --- Net3-Proxy/ExpressionEx.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Net3-Proxy/ExpressionEx.cs b/Net3-Proxy/ExpressionEx.cs index 15adb6c8..f5eb40e2 100644 --- a/Net3-Proxy/ExpressionEx.cs +++ b/Net3-Proxy/ExpressionEx.cs @@ -166,7 +166,10 @@ namespace Net3_Proxy } Expression topBody; - if (lastType != null) + + if (rest.Count == 0) + topBody = info.Param; + else if (lastType != null) { var execSeq = ExecuteSequenceTyped.MakeGenericMethod(lastType); topBody = Expression.Call(null, execSeq, last, Expression.NewArrayInit(typeof(Action), rest.Cast()));