c# - How to use Delegate actions as a parameter? -
i used delegate action parameter in method follows:
private ienumerable<sc.serverpathservices.gafpfileinfo> startprojectarchive(int32 projectid, int32 sourceserverpathid, action uirefresh,action<ienumerable<projectfile>> popupfiles)
here have 2 delegates. have problem popupfiles delegate.
i calling in method passing list of files parameter popupfiles follows:
if(popupfiles!=null) popupfiles(filesmodifiedinsourceserver);
here filesmodifiedinsourceserver contains list of files. calling in code behind file follows:
archiveresponse = projectmanager.startprojectarchive(projectid, 0, () => { foreach (control control in tdfilelist.controls.cast<control>()) { if (control dell.afp.usercontrol.projectfilelistbasecontrol) { ((projectfilelistbasecontrol)control).refresh(); } } }, (filesmodifiedinsourceserver)=> { if (filesmodifiedinsourceserver != null && filesmodifiedinsourceserver.count > 0) { popupmodifiedfiles(filesmodifiedinsourceserver); } });
but in above code when passing parameter delegate action popupfiles used filesmodifiedinsourceserver parameter. giving me error delegate action not take 1 argument. how else can pass parameter? resolved. getting object reference error while calling method. not know why throwing object reference error.
Comments
Post a Comment