[RESOLVED] little Q about implementing an interface's functions...
syntax issue here, suppose a class implements IDisposable, then are these two considered the same inside this class?
Code:
void IDisposable.Dispose()
{}
public void Dispose()
{}
Re: little Q about implementing an interface's functions...
Not if you use a fully qualified prefix for interface method declarations, as you have. However, that being said, it isn't recommended
[Edit]
The above will only work if the method is inherited from a parent class - you will get a build warning ("modifier 'new' is needed").
If you have explicitly defined your own Dispose method in the same class, you will get a build error.
Re: little Q about implementing an interface's functions...
hmm so usually I see the first one on MSDN, you're saying it isnt recommended?
also, what's the difference, I dont really understand :( kinda confused
Re: little Q about implementing an interface's functions...
Haven't noted anything like that in MSDN - may I ask where you found it?
When I say not recommended, I mean that designing an application so that it will inherit specific method signatures that conflict with interface method signatures :)
The difference between creating your own Dispose as opposed to implementing IDisposable? One imagines that when the .Net framework searches for Dispose implementations, it will search the inheritance / implementation routes used - i.e. search for IDisposable, and not Dispose itself. Although, if you're going to be calling Dispose yourself, I guess it's six of one...
Re: little Q about implementing an interface's functions...
well look at this for example http://msdn.microsoft.com/library/de...classtopic.asp
they use IDeserializationCallback.OnDeserialization
both of the Dispose() ones I have above seem to do the same: implement the Dispose method of the IDisposable interface.
Re: little Q about implementing an interface's functions...
Oh! You mean using just the method name as opposed to fully qualifying it? Nope, no difference whatsoever.
Sorry - seems I was barking up the wrong tree...
Re: little Q about implementing an interface's functions...
:D:D:D lol yeah that's what I was asking
hmm it's a bit more clear to use the fully qualifying name I guess
thanks for the posts though... I was confusing as whether there was a difference or whether one was right or wrong