Hi, This is my first time using delegate in c# application. can some one check if i use this correctly.
int totalsales = 0;
adddata(){
........
BeginInvoke(new UpdateSalesDelegate(UpdateSales), numbersale);
}
private delegate void UpdateSalesDelegate(int args);
private void UpdateSales(int args){
totalsales = totalsales + args;
Label.Text = "Total Sales: " + totalsales.ToString();
}
or should i use
adddata(){
........
BeginInvoke(new UpdateSalesDelegate(UpdateSales), new int numbersale);
}
.................
which way is correct ?