I Used a delegate action as a parameter in a method as follows:
private IEnumerable<SC.ServerPathServices.GAFPFileInfo> StartProjectArchive(Int32 projectID, Int32 sourceServerPathID, Action uiRefresh,Action<IEnumerable<ProjectFile>> PopUpFiles)
Here I have two delegates. I have a problem with PopUpFiles Delegate.
I am calling this in my method by passing list of files as a parameter to PopUpFiles As follows:
if(PopUpFiles!=null)
PopUpFiles(filesModifiedInSourceServer);
Here filesModifiedInSourceServer contains list of files. I am calling this in a code behind file as follows:
archiveResponse = projectManager.StartProjectArchive(projectId, 0, () =>
{
foreach (Control control in tdFileList.Controls.Cast<Control>())
{
if (control is Dell.AFP.UserControl.ProjectFileListBaseControl)
{
((ProjectFileListBaseControl)control).Refresh();
}
}
},
(filesModifiedInSourceServer)=>
{
if (filesModifiedInSourceServer != null && filesModifiedInSourceServer.Count > 0)
{
PopUpModifiedFiles(filesModifiedInSourceServer);
}
});
But in the above code when I am passing parameter for the delegate action PopUpFiles I used filesModifiedInSourceServer as a parameter. It is giving me an error as delegate action does not take one argument. How else I can pass the parameter? this is resolved. Now I am getting object reference error while calling that method. I do not know why it is throwing object reference error.