473,405 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

How to implement a method as different name

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!
Feb 19 '07 #1
6 4764
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
"Steven.Xu" wrote:
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!
Feb 19 '07 #2
>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
--
http://www.sturmnet.org/blog
Feb 21 '07 #3
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
"Oliver Sturm" wrote:
>
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
--
http://www.sturmnet.org/blog
Feb 21 '07 #4
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
--
http://www.sturmnet.org/blog
Feb 21 '07 #5
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
"Oliver Sturm" wrote:
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
--
http://www.sturmnet.org/blog
Feb 21 '07 #6
Hello David,
>Right - I was just elaborating on that ("...explicit interface
implementation
does prevent most of the need for renaming...").
Right :-)
Oliver Sturm
--
http://www.sturmnet.org/blog
Feb 21 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Medi Montaseri | last post by:
Hi, I think my problem is indeed "how to implement something like java's final in C++" The long version.... I have an abstract base class which is inherited by several concrete classes. I...
3
by: Erik Harris | last post by:
I apologize if this is a stupid question - I'm relatively new to OOP. I have a property that must exist in a class in order to be used by another class. The property, however, does not change with...
1
by: Pieter | last post by:
Hi, I have my own custom BindingList, that inherits from BindingList, and implements IComponent. I would like to implement a Find-method, that will allow me to search for a property of my...
7
by: moondaddy | last post by:
If I'm in a class that inherits an interface, is there a shortcut key that will write the implementation of the interface into the class? I remember seeing something like this in vb.net. ...
11
by: Manuel | last post by:
Hi, I need implement a map of member functions of some class. This map is formed by a string and a pointer to the member function. The problem is that the map need that the object saved are...
4
by: PenguinPig | last post by:
Dear Experts, Could you please provide you comment to me? Thanks An Exhibition has many Halls, and different Booth Types If exhibition is not exist, hall and booth type will not exist too. ...
0
by: emin.shopper | last post by:
I had a need recently to check if my subclasses properly implemented the desired interface and wished that I could use something like an abstract base class in python. After reading up on metaclass...
8
by: John | last post by:
Hi, gurus, How can I implement the following feature in C#: Set objGroup = GetObject("WinNT://" & strComputer & "/" & strGroup & ", group") For Each objMember In objGroup.Members...
5
by: Tony Johansson | last post by:
Hello! The only reason I can see interface to be implemented explicitly is when the a class implement two interface having the same method signature. In all other cases I can implement interface...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.