By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,161 Members | 1,301 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,161 IT Pros & Developers. It's quick & easy.

Threadpool LateBinding

P: n/a
Ok,

I am utilizing the threadpool class to manage a number of threads.
Priority is not important to me and neither is if the threads are
background or foreground threads so I opted for the threadpool class.

The issue is that I am latebinding on several libraries that I have.
(They're actually plug-ins.) How would I send the methods to the
threadpool?

Any help would be much appreciated.

Angelo

Jan 31 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Jan 31, 11:41 am, "Angelo" <angelo...@gmail.comwrote:
Ok,

I am utilizing the threadpool class to manage a number of threads.
Priority is not important to me and neither is if the threads are
background or foreground threads so I opted for the threadpool class.

The issue is that I am latebinding on several libraries that I have.
(They're actually plug-ins.) How would I send the methods to the
threadpool?

Any help would be much appreciated.

Angelo
Angelo,

Obtain a reference to a MethodInfo object that describes the method
you want to run and call Invoke on it from a ThreadPool thread.

If you're using C# 2.0 this is both easy and elegant using anonymous
methods.

Object obj = GetSomeObject("SomeObject");
ThreadStart method = delegate()
{
obj.GetType().GetMethod("SomeMethod").Invoke(obj, null);
};
IAsyncResult ar = method.BeginInvoke(null);

However, if you're plugins adhere to specific interface then you
shouldn't have to make late-bound calls at all.

Brian

Jan 31 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.