Why Stream.CopyTo is not extension method?
.NET Framework 开发者_如何学JAVA4 introduces new helper method Stream.CopyTo. It uses Read/Write methods and doesn't require access to any internal members of stream. It's not virtual and you can't override it.
So my question is why Stream.CopyTo is an instance method? It can be easily implemented as an extension. Is this because Stream is an abstract class and not an interface?
It doesn't cause any issues, just interesting :)
It doesn't really make much sense to create an extension method for a type for which you have the code.
精彩评论