"default" Attribute to give to interface implementations. #1104
Replies: 6 comments
-
|
Beta Was this translation helpful? Give feedback.
-
Just curious: why not make it |
Beta Was this translation helpful? Give feedback.
-
different but similar to #964 |
Beta Was this translation helpful? Give feedback.
-
@jnm2 I agree. The problem that op is trying to solve with the default attribute can be solved by proper design, I don't think this feature (DefaultInterface) would benefit a lot of people:
and then just:
should work. |
Beta Was this translation helpful? Give feedback.
-
You are right, this is something that can be fixed with correct design. |
Beta Was this translation helpful? Give feedback.
-
I reopen this issue because of this scenario.
how can I improve my design? if I deprecate enumerable from readonly interface it works, but I want that. (enumerating is basic function) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a custom list like
because multiple interfaces are implemented, I cant use linq easily. so I have to write something like
It would be nice if I could give priority to interface implementations which tells compiler, if you cant infer type from usage, pick this one.
this probably is hard to implement, but I think its worth it to help inferring generic type arguments from usage.
By the way I can always cast my list into preferred ienumerable before writing query, but since its part of API, putting this limitation away would be nice.
Beta Was this translation helpful? Give feedback.
All reactions