Replies: 4 comments
-
This would be a breaking change because it could change the overload resolution result for method calls in existing code. |
Beta Was this translation helpful? Give feedback.
-
@gafter Oh that's a bummer! It would however simplify a lot of code, and basically open the road for easy usage of user-defined types that combine delegate and non-delegate types like the example above. Perhaps you can make it opt-in via a switch (after all you guys said you will already be introducing a switch for Null reference types). EDIT 1 : EDIT 2: |
Beta Was this translation helpful? Give feedback.
-
The introduction if a switch for null reference types is very much the exception that proves the rule - they've been extremely clear about their desire to avoid splintering the language into multiple dialects. The only reason null references get a pass - and a switch - is due to their extremely high value.
In my opinion, fewer keystrokes is not a reason to evolve the language - code is read much more than it is written. Conciseness is important because it makes the code easier to read, not easier to write. |
Beta Was this translation helpful? Give feedback.
-
The null reference type feature does not affect the meaning of code, it only produces warnings. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
As is explained in this StackOverflow question, it would be really nice that given a user defined type:
And say a method:
It should be possible to utilize this type like so:
However, as of C# 7.3 the above won't compile and instead an explicit, ugly-looking cast is required:
Beta Was this translation helpful? Give feedback.
All reactions