Replies: 4 comments
-
As for delegate inference, it suffers the same problem that all delegate inference proposals have: the lack of signature equivalence in the CLR and the overhead of delegate conversion. Also, why |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
@elcergey
That is the assignment of a local variable. While |
Beta Was this translation helpful? Give feedback.
-
I really don't see any significant difference between the two lines: func<bool> foo= () => true;
Func<bool> foo= () => true; What would really be of use would be to have the compiler infer the types of var foo = () => true; // foo is Func<bool> and to remove the need to specify all generic parameters when some can be inferred, eg: TR Bar<T, TR>(T p) => default(TR);
var foo = Bar<,bool>(1); |
Beta Was this translation helpful? Give feedback.
-
Present syntax for anonymous delegates (Func<type1, type2, ...> ) and expressions is rather cumbersome.
So I think we need "legitimate" keywords for Func and Expression<Func> (thus, avoiding the necessity to "use" System and System.Linq.Expression namespaces:
Also, it would be nice to write it even like this (that is, when we will finally have had anonymous delegate type inference):
auto is inferrable type here.
That small feature would make C# look cleaner.
Beta Was this translation helpful? Give feedback.
All reactions