Interface implementation with different method names

I have this interface:

public interface INameScope
{
    void Register(string name, object scopedElement);
    object Find(string name);
    void Unregister(string name);
}

But I want my implementation have different names for the methods. My implementation already has a Register method that has another meaning.

Isn't there a method to make implemented methods have names like "RegisterName", "FindName" or "UnregisterName" instead of having to use the very same names?

Jon Skeet
people
quotationmark

Not quite, but you can use explicit interface implementation:

public class SomeScope : INameScope
{
    void INameScope.Register(string name, object scopedElement)
    {
        RegisterName(name, scopedElement);
    }

    public void Register(...)
    {
        // Does something different
    }

    public void RegisterName(...)
    {
        // ...
    }

    ...
}

I would be very wary of doing this if your existing Register method has similar parameters though - while the compiler will be happy with this, you should ask yourself how clear it's going to be to anyone reading your code:

SomeScope x = new SomeScope(...);
INameScope y = x;
x.Register(...); // Does one thing
y.Register(...); // Does something entirely different

people

See more on this question at Stackoverflow