473,394 Members | 1,645 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,394 software developers and data experts.

HELP: Delegates to interface methods

Hi Everyone. I have an interface:

Expand|Select|Wrap|Line Numbers
  1. namespace SharedInterfaces
  2. {
  3.   public interface ICommunicationService
  4.   {
  5.     void SaySomething( String pText );
  6.   }
  7. }
  8.  
What I'm trying to do is implement a wrapper that calls the SaySomething() method on a worker thread which will abort the thread if it takes too long.

Expand|Select|Wrap|Line Numbers
  1. public delegate void MyFunc( String s );
  2. ...
  3. public ICommunicationService  obj;
  4.  
  5. obj = ( ICommunicationService ) 
  6.             Activator.GetObject( typeof( ICommunicationService ),
  7.                                  "ipc://IPChannelName/PaulStuff" );
  8.  
  9. // The below line won't work..
  10. public MyFunc f = obj.SaySomething;
  11.  
Does anybody know how I can get a generic delegate (function pointer) to point to one of my interface methods?

Thanks
Paul
Sep 11 '07 #1
0 711

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Chua Wen Ching | last post by:
Hi there, I just read Chris Sells's article at http://www.codeproject.com/csharp/delegate_bedtime.asp?df=100&forumid=2983&select=922269#xx922269xx I wonder i can do this: 1) I want to...
3
by: Rich | last post by:
Hello, I recently started using delegates in my VB apps to handle asynchronous operations. Based on the examples that I followed, delegates appear to work in a similar way as Interfaces. ...
5
by: sajin | last post by:
Hi All.. We are using VB .Net 2005 for implementing an API. API needs to generate events. For this client wants us to use Windows Callback (delegate implementation). The intention of using...
5
by: raylopez99 | last post by:
I understand delegates (static and non-static) and I agree they are very useful, and that the "Forms" used in the Windows .NET API could not work without them. That said, I'm curious as to how...
2
by: hcaptech | last post by:
This is my Test.can you help me ? 1.Which of the following statement about C# varialble is incorrect ? A.A variable is a computer memory location identified by a unique name B.A variable's name...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.