How to implement a method as different name

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi guys,
How can i implement a method of interface in a new class as different method
name. Something like use Implement key word in VB.NET.

Thanks!
 
You do not have that option in C#. Methods which implement interface methods
are recognized solely by signature.
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
Instant Python: C#/VB to Python converter
 
You do not have that option in C#. Methods which implement interface
methods
are recognized solely by signature.

Let me add to this that you can use something called "explicit interface
implementation" in C#. This is useful in cases where there's naming
conflict between various methods - I actually use it a lot of the time
when implementing interfaces, instead of waiting for the conflict to appear.

See this MSDN page for details:

http://msdn2.microsoft.com/en-us/library/ms173157.aspx



Oliver Sturm
 
You are still required to use the interface method name, although explicit
interface implementation does prevent most of the need for renaming in these
cases that would occur in VB.
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
Instant Python: C#/VB to Python converter
 
Hello David,
You are still required to use the interface method name, although explicit
interface implementation does prevent most of the need for renaming in
these
cases that would occur in VB.

I wasn't saying this does the same thing as the VB keyword the OP referred
to. I was trying to guess what the original intention was, and offering
explicit interface implementation as a possible solution.


Oliver Sturm
 
Right - I was just elaborating on that ("...explicit interface implementation
does prevent most of the need for renaming...").
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
Instant Python: C#/VB to Python converter
 
Hello David,
Right - I was just elaborating on that ("...explicit interface
implementation
does prevent most of the need for renaming...").

Right :-)


Oliver Sturm
 
Back
Top