Open dzmitry-lahoda opened 5 years ago
Do you have a reference or example?
mentions Dispose (need to install beta of C# 8) and Deconstruct https://blogs.msdn.microsoft.com/dotnet/2019/01/24/do-more-with-patterns-in-c-8-0/
SelectMany https://mikehadlow.blogspot.com/2011/01/monads-in-c-4-linq-loves-monads.html . Just put SelectMany or Select and LINQ will catch up.
and it is called Structural Typing, not Duck.
Duck typing is similar to, but distinct from structural typing. Structural typing is a static typing system that determines type compatibility and equivalence by a type's structure, whereas duck typing is dynamic and determines type compatibility by only that part of a type's structure that is accessed during run time.
The OCaml, Scala, Go, Elm,[4], Gosu and PureScript languages support structural typing to varying degrees.
Could we put C#[N] onto your article?
In C# duck is dynamic
or reflection.
I guess Next/Current to get foreach could also be structural(duck).
I think there could be TaskLike(ValueTask and Task) stuff https://github.com/dotnet/roslyn/blob/master/docs/features/task-types.md. I guess i need the list of all such extension points. So may be or fork it
.
Next is also
[EditorBrowsable(EditorBrowsableState.Never)]
public ref readonly T GetPinnableReference();
https://github.com/mariusGundersen/website/blob/master/article/duck-extensions/index.md