Implicit and Explicit implementation of interface.

Posted by Amby on Stack Overflow See other posts from Stack Overflow or by Amby
Published on 2010-05-03T06:46:54Z Indexed on 2010/05/03 6:48 UTC
Read the original article Hit count: 360

Filed under:
|
|

While working on a upgrade i happened to come across a code like this.

interface ICustomization
    {
        IMMColumnsDefinition GetColumnsDefinition();
    }

    class Customization : ICustomization
    {
        private readonly ColumnDefinition _columnDefinition;

        //More code here.

        public ColumnsDefinition GetColumnsDefinition()
        {
            return _columnDefinition;
        }

        ColumnsDefinition ICustomization.GetColumnsDefinition()  //redundant
        {
            return GetColumnsDefinition();            
        }
    }

My question is: Is there any need/use of 'explicit' implementation of interface in this piece of code? Will it create any problem if i remove the method (explicit implementation of interface) that i have marked "redundant" above?

PS: I understand that explicit implementation of interface is very important, and it can be used when we need to give access to a method at interface level only, and to use two interface with same signature of method.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#