Click here to Skip to main content
16,004,828 members
Home / Discussions / C#
   

C#

 
AnswerRe: Two interfaces with same function name Pin
Deresen25-Mar-09 0:23
Deresen25-Mar-09 0:23 
AnswerRe: Two interfaces with same function name Pin
ABitSmart25-Mar-09 0:30
ABitSmart25-Mar-09 0:30 
AnswerRe: Two interfaces with same function name Pin
DaveyM6925-Mar-09 0:41
professionalDaveyM6925-Mar-09 0:41 
GeneralRe: Two interfaces with same function name Pin
.NET- India 25-Mar-09 1:55
.NET- India 25-Mar-09 1:55 
GeneralRe: Two interfaces with same function name [modified] Pin
DaveyM6925-Mar-09 2:24
professionalDaveyM6925-Mar-09 2:24 
GeneralRe: Two interfaces with same function name Pin
.NET- India 25-Mar-09 2:35
.NET- India 25-Mar-09 2:35 
Generallazy Pin
Luc Pattyn25-Mar-09 3:13
sitebuilderLuc Pattyn25-Mar-09 3:13 
GeneralRe: Two interfaces with same function name Pin
DaveyM6925-Mar-09 3:22
professionalDaveyM6925-Mar-09 3:22 
It's because of the two different methods of implementing.

You can implement an interface implicitly or explicitly. Consider the sample below. IMyFirstInterface is implemented implicitly. That is the implementation that will implicitly be used unless you explicitly state otherwise.

IMySecondInterface is implemented explicitly - you have to explicitly state that you want to use that implementation.
MyImplementingClass implementingClass = new MyImplementingClass();
implementingClass.Method(1);
if (implementingClass is IMySecondInterface)
{
    ((IMySecondInterface)implementingClass).Method(1);
}
public class MyImplementingClass : IMyFirstInterface, IMySecondInterface
{

    #region IMyFirstInterface Members

    public void Method(int value)
    {
        Console.WriteLine(value);
    }

    #endregion

    #region IMySecondInterface Members

    void IMySecondInterface.Method(int value)
    {
        Console.WriteLine("Value = {0}", value);
    }

    #endregion
}

public interface IMyFirstInterface
{
    void Method(int value);
}

public interface IMySecondInterface
{
    void Method(int value);
}


Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)

GeneralRe: Two interfaces with same function name Pin
S. Senthil Kumar25-Mar-09 5:46
S. Senthil Kumar25-Mar-09 5:46 
GeneralRe: Two interfaces with same function name Pin
DaveyM6925-Mar-09 6:42
professionalDaveyM6925-Mar-09 6:42 
GeneralRe: Two interfaces with same function name Pin
King Julien25-Mar-09 0:48
King Julien25-Mar-09 0:48 
QuestionFill combo box from excel Pin
shantanusenin24-Mar-09 22:48
shantanusenin24-Mar-09 22:48 
QuestionDataGridView Save changes cell only after leaving the row ? Pin
unitecsoft24-Mar-09 22:30
unitecsoft24-Mar-09 22:30 
AnswerRe: DataGridView Save changes cell only after leaving the row ? Pin
Eddy Vluggen24-Mar-09 22:54
professionalEddy Vluggen24-Mar-09 22:54 
GeneralRe: DataGridView Save changes cell only after leaving the row ? Pin
unitecsoft24-Mar-09 22:59
unitecsoft24-Mar-09 22:59 
GeneralRe: DataGridView Save changes cell only after leaving the row ? Pin
Eddy Vluggen24-Mar-09 23:34
professionalEddy Vluggen24-Mar-09 23:34 
GeneralRe: DataGridView Save changes cell only after leaving the row ? Pin
unitecsoft25-Mar-09 0:52
unitecsoft25-Mar-09 0:52 
GeneralRe: DataGridView Save changes cell only after leaving the row ? Pin
Eddy Vluggen25-Mar-09 5:32
professionalEddy Vluggen25-Mar-09 5:32 
QuestionPaths in Crystal... Pin
Stephen Lintott24-Mar-09 21:29
Stephen Lintott24-Mar-09 21:29 
AnswerRe: Paths in Crystal... Pin
Stephen Lintott24-Mar-09 22:41
Stephen Lintott24-Mar-09 22:41 
Questionplz help Pin
grkrishna24-Mar-09 21:14
grkrishna24-Mar-09 21:14 
AnswerRe: plz help Pin
SeMartens24-Mar-09 21:17
SeMartens24-Mar-09 21:17 
GeneralRe: plz help Pin
grkrishna24-Mar-09 22:20
grkrishna24-Mar-09 22:20 
GeneralRe: plz help Pin
Pete O'Hanlon24-Mar-09 22:36
mvePete O'Hanlon24-Mar-09 22:36 
QuestionHow to save image in a folder? and how to show image in a picturebox with windows project by C# language Pin
Rahad Rahman24-Mar-09 20:34
professionalRahad Rahman24-Mar-09 20:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.