i get this error when trying this:
ERROR method name expected.
How should i do to correct the problem
delegate void DelegateFillList(DeliveryDoc[] deliveryDocs);
private void FillListViewAssignment(DeliveryDoc[] docs) {
if(lvMyAssignments.Dispatcher.CheckAccess()) {
lvMyAssignments.ItemsSource = docs;
lvAllOngoingAssignments.ItemsSource = docs;
if(m_tempDeliveryDocs != null) {
txtblockHandOverCount.Text = m_tempDeliveryDocs.Length.ToString();
}
} else {
lvMyAssignments.Dispatcher.BeginInvoke(
new DelegateFillList(FillListViewAssignment(docs)), null);
}
}
This is the problem:
You can’t create a delegate that way. You need to provide a method group which is just the name of the method:
Alternatively, you could do it in two statements:
The reason for the extra “wrapping” array is that you’ve only got one argument, which is an array – you don’t want it to try to interpret that as a bunch of different arguments.