Pass parameter to a delegate

  • Thread starter Thread starter Curious
  • Start date Start date
C

Curious

I have a C#.NET program that uses a delegate,
"BuildExistingReportFile". It's called in such a fashion:

IList lFiles = this.GetListFromStoredProcedure(
null,
Constants.StoredProcedures.SPcorReportInstanceFilesGet,
new BuildDelegate(new
ReportClosure(aReport).BuildExistingReportFile),
new SqlParameter("@ReportInstanceID",aReport.ID));

I don't see any parameter passed to "BuildExistingReportFile".
However, it's defined as below:

public object BuildExistingReportFile(IRecord aRecord)
{
\\blah blah
}

Now I want to add an integer type of parameter, "counter", to this
delegate. How can I pass this parameter in?

Thanks!
 
I have a C#.NET program that uses a delegate,
"BuildExistingReportFile". It's called in such a fashion:

Looks like the delegate type is actually called BuildDelegate and that
BuildExistingReportFile is the method that the delegate object will
call.

Now I want to add an integer type of parameter, "counter", to this
delegate. How can I pass this parameter in?

- Modify the delegate type (BuildDelegate).
- Modify the method signature to match (BuildExistingReportFile).
- Modify the calling code (probably somewhere inside
GetListFromStoredProcedure).


Mattias
 
Mattias,

Thanks for the valuable advice! Sounds like the way to go. I'll try it
out. In case I have question, I'll ask again.
 
Back
Top