Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8832769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:36:43+00:00 2026-06-14T08:36:43+00:00

Possible Duplicate: C#: Interfaces – Implicit and Explicit implementation I was reading about Interface

  • 0

Possible Duplicate:
C#: Interfaces – Implicit and Explicit implementation

I was reading about Interface reimplementation.
I am not sure what does this mean?
” implicitly implementing a member and explicitly implementing a member”

Sample code:

Explicit member implementation:

public interface IUndoable { void Undo(); }
public class TextBox : IUndoable
{
void IUndoable.Undo() { Console.WriteLine ("TextBox.Undo"); }
}
public class RichTextBox : TextBox, IUndoable
{
public new void Undo() { Console.WriteLine ("RichTextBox.Undo"); }
}

Implicit member implementation:

public class TextBox : IUndoable
{
public void Undo() { Console.WriteLine ("TextBox.Undo"); }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T08:36:45+00:00Added an answer on June 14, 2026 at 8:36 am

    Explicit interface implementation allows you to implement different interfaces which have members with same signature. Also it allows you to hide interface implementation (implemented members will be available only via reference of interface type):

    public interface IUndoable 
    { 
       void Undo(); 
    }
    
    public interface IVeryUndoable 
    { 
       void Undo(); 
    }
    
    public class TextBox : IUndoable, IVeryUndoable
    {
         void IUndoable.Undo() { Console.WriteLine ("TextBox.Undo"); }
         void IVeryUndoable.Undo() { Console.WriteLine ("TextBox.VeryUndo"); }
    }
    

    In this case you have two methods Undo() with same signature. But when you hit . on your textbox variable, none of methods will be available. You need to cast textbox variable to explicitly implemented interface type:

     IUndoable undoable = (IUndoable)textbox;
     undoable.Undo(); // now member available
    

    Why would you hide some interface implementation? To keep your object API more clean. Example from .net: List<T> implements implicitly IList<T>, but hides implementation of non-generic IList. So, you can pass lists where non-generic IList expected, but non-generic methods like Add(object value) do not pollute nice generic interface.

    Same with IDisposable – you can have nice method with name Close and explicitly implemented Dispose (which will call your Close method). API will be clean – only Close will be visible. But your object will be possible to use in using blocks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: C#: Interfaces - Implicit and Explicit implementation Would someone explain the differences
Possible Duplicate: Is it safe for structs to implement interfaces? Take this code: interface
Possible Duplicate: Why does (does it really?) List implement all these interfaces, not just
Possible Duplicate: Why does Eclipse complain about @Override on interface methods? I have some
Possible Duplicate: What does the text inside parentheses in @interface and @implementation directives mean?
Possible Duplicate: Ternary Expression with Interfaces as a Base Class Classes: interface ISms {
Possible Duplicate: Java Interfaces? What is the use of interface in java? Is interface
Possible Duplicate: Method name collision in interface implementation - Java What do we do
Possible Duplicate: Protected in Interfaces The following code snippet shows that an interface in
Possible Duplicate: Why is there not a ForEach extension method on the IEnumerable interface?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.