Anonymous Method Trick
I found out a quick way of using anonymous methods to wrap a call:
WaitCallback callback = delegate(object client)
{
processString((string)client);
};
ThreadPool.QueueUserWorkItem (callback, "the string");
the target method:
void processString(string initstring)
{
...
}
Because the QueueUserWorkItem uses the delegate WaitCallback which accepts an "object" we can use the anon method to do the casting preserving the target method signature.

1 Comments:
This may sound like I don’t know anything [true] but is this for a cell sms?
Post a Comment
Subscribe to Post Comments [Atom]
<< Home