A
A
Akaero2018-03-01 15:40:22
C++ / C#
Akaero, 2018-03-01 15:40:22

Why would you want to hide interface methods?

Good afternoon, connoisseurs! Please give an example when I need to hide an interface method by declaring it explicitly.

public sealed class Sample: ISample
{
    public void InterfaceMethod()
    {
        // do something here
    }
 
    void ISample.SecondInterfaceMethod()
    {
        // do something here that should be used only by ISample interface
    }
}

Here is an article on how to do it
https://gedgei.wordpress.com/2009/08/24/hiding-pro...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daniil Basmanov, 2018-03-01
@Akaero

Array explicitly implements ICollection.Count so as not to pollute the interface with the same properties.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question