With the Dispose problem: I say make the Dipose() public or protected. This is functionality that should always be exposed, if not to all classes, at least those that inherit from an IDisposable object.
The confusion (if any) caused between Close() and Dispose() is negligible in in my opinion, and is an issue that can (and usually is) resolved with good documentation addressing the possible confusion. There is definitely a conceptual difference between the
two methods (even if there is no difference in its implementation)

Hi Joedu! I hope you are not changing the behaviour of the interfaces!!

I mean if I implement for example IList and IList<T>, but I want to show the user only the IList<T> implementation. I'm hiding IList by implementing it implicitly (i guess this was the right term - I'm always confusing them). If somebody wants the implementation
of IList the cast to IList must be done. It should be done this way and nothing should be changed.

Are you going to change this behaviour? Are all members of IList and IList<T> then accessible without cast (even the one from IList)?

Littleguru: No, that's not what I was suggesting, although with the minimal amount of explanation I did in the video, I can see how one would get that impression.

The primary problem is that there's no way to call this from a base class. If it weren't explicitly implemented, you could easily just do:

base.Dispose();

But because explicit implementations are emitted as private by the C# compiler (which the team firmly believes is the correct design), this isn't possible. You can't even do it in IL. One could imagine new C# syntax that made this possible:

((IDisposable)base).Dispose();

But this would only be possible with either
a) Explicitly implemented methods being emitted as family; or,
b) A "basecall" IL instruction.

We're going to look at these in future releases, but we dropped the idea for Whidbey.

Remove this comment

Remove this thread

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums, or
Contact Us and let us know.