Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

delegates and generics

Status
Not open for further replies.

Badgers

Programmer
Nov 20, 2001
187
US
Hi,

I am using some delegates to help me perform some async processing as follows:

Action<object> executeCircuitAction = ExecuteCircuit;
this.CircuitBreaker.Execute(executeCircuitAction, o);

Then the Execute call maps to

public object Execute(Delegate operation, params object[] args)

of which the invoke bit is below
result = operation.DynamicInvoke(args);

What I want to do is remove the object and replace a generic.

I have tried this

public T Execute<T,T1>(Delegate operation, params T1[] args)

Which binds nicely to

string xmlResponse = base.CircuitBreaker.Execute<string, IWebServiceConfig>(executeCircuitAction, base.WebServiceConfig);

but I then get an error of course with

result = operation.DynamicInvoke(args);

Does anyone know how this could be coded correctly.

Thanks
 
you need to convert T[] args to an object array.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top