implicit constructor to func conversion #885
Replies: 8 comments
-
Beta Was this translation helpful? Give feedback.
-
The fact that constructors cannot be used as functions has been a PITA in many situations. Would love to see this added to the language. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I've preferred |
Beta Was this translation helpful? Give feedback.
-
I like it, but what if there's already a static member named |
Beta Was this translation helpful? Give feedback.
-
@yaakov-h C# considers |
Beta Was this translation helpful? Give feedback.
-
Is it not a reserved keyword? |
Beta Was this translation helpful? Give feedback.
-
Good point, nvm. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Wherever the parameter required in a function is a Func<T, T2> you can supply a T2 constructor that requires T as a parameter
for example you can do something like that
which is the equivalent to this :
i think it looks cleaner
(i opened a pull-request before i knew i needed to create issue first #884 )
Beta Was this translation helpful? Give feedback.
All reactions