There is no performance difference. The main advantage is that you do not
dirty the public interfaces of your class. Also, if you have two interfaces
that have the same method signature and you want two different
implementations then you will have to use explicit implementation.

Also note that your code below will not compile. Use instead:
---->
void Foo.Bar() { /* implementatoin */ }
<----

--
Peter


> Ethan Smith spake:
>
> Hi all,
>
> When calling a method through an interface reference, is there any
> functional or performance difference between having that implementation
> being a public method, or an explicit interface method that calls the
> public method?
>
> E.g.:
>
> Interface Foo{
>         void Bar();
> }
>
> public class Baz : Foo{
>
>         public Bar(){}
>
>         // is there any advantage to explicitly
>         // defining this function?
>         Foo.Bar{
>                 This.Bar();
>         }
> }
>
> -Ethan

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to