You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is more for a discussion than a proposal as I'm not sure how this can be done and handled because I assume there are lots of legit and corner cases to cover here even if I was able to only come up with one below.
For the below case for example, it would be possible to use Stream instead of FileStream:
using (FileStream stream = File.Open(@"c:\dev\foo.txt", FileMode.Open))
Cases to cover:
We need to make sure that any members that are specific to FileStream is not used inside the code block.
return signature might be FileStream for the method and the stream could be instance which is being returned.
The text was updated successfully, but these errors were encountered:
@tugberkugurlu I'm really concerned about this idea. I think there are very common cases where this could cause wrong effects, especially where interfaces are concerned.
Consider if this refactoring were to replace an IQueryable with its base, IEnumerable. That would change the processing of that query from being remoted to data storage engine, and make all processing happen locally, using LINQ to Objects.
This is less of an issue with classes than interfaces, but I think we need to be very careful here.
@BillWagner I agree. I just wanted to put it here to see what others think. I'm nowhere near to attempt to implement this at this stage as it looks really complicated to get it right.
For the below case for example, it would be possible to use
Stream
instead ofFileStream
:Cases to cover:
FileStream
is not used inside the code block.FileStream
for the method and the stream could be instance which is being returned.The text was updated successfully, but these errors were encountered: