Question: I am getting this error while creating a `public` method on a class for explicitly implementing the `interface`. I have a workaround: by removing the explicit implementation of `PrintName` method. But I am surprised why I am getting this error.

Can anyone explain the error?

Code for Library:

```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Test.Lib1
{

    public class Customer : i1 
    {
        public string i1.PrintName() //Error Here...
        {
            return this.GetType().Name + " called from interface i1";
        }
    }

    public interface i1
    {
        string PrintName();
    }

    interface i2
    {
        string PrintName();
    }
}

```

Code for Console Test Application:

```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Test.Lib1;

namespace ca1.Test
{
    class Program
    {
        static void Main(string[] args)
        {
            Customer customer = new Customer();
            Console.WriteLine(customer.PrintName());

            //i1 i1o = new Customer();
            //Console.WriteLine(i1o.printname());

            //i2 i2o = new Customer();
            //Console.WriteLine(i2o.printname());

        }
    }
}

```

Answer: 
<http://msdn.microsoft.com/en-us/library/aa288461(VS.71).aspx> :
When a member is explicitly implemented, it cannot be accessed through a class instance, but only through an instance of the interface.

```
Customer customer = new Customer();

```

`Console.WriteLine(customer.PrintName());`

Violates this
When we want to go with implicit implementation for the above example, following would be the code.

```
    interface I1 { void M(); }
interface I2 { void M(); }

class C : I1, I2
{
    public void M() { ... }
}

C c = new C();
c.M();  // Ok, no ambiguity. Because both Interfaces gets implemented with one    method definition.

```