Allow var
in method overrides
#7731
Replies: 3 comments 3 replies
-
The IDE already generates the signature for you so I don't see much point in avoiding having the explicit types in the signatures. I'd rather the clarity than having to navigate back to the base type to understand what it does. Not to mention, that wouldn't work with overloads. |
Beta Was this translation helpful? Give feedback.
-
I'm against it.
Probably devs want to leave information about method, so they don’t take this approach |
Beta Was this translation helpful? Give feedback.
-
With covariant return, the return type of overridden method isn't necessarily the same of base method. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi C# team:
When working with Overrides, it would be great if I could use
var
. This would save me a lot of manual refactoring work which changing types.var
should work whenever it can be absolutely resolved with no ambiguity. If var would introduce an ambiguity in an override, then it should not be allowed in that situation.Here is an example:
Beta Was this translation helpful? Give feedback.
All reactions