Which code segment should you use?

You are creating a Windows Forms application. You implement the asynchronous design pattern by using a delegate named DataUpdateHandler. DataUpdateHandler executes a method named DataUpdater. You create an instance of the DataUpdateHandler that has the variable name Updater. DataUpdater uses a DataSet class as a parameter and returns an integer value that indicates the number of rows that have been updated. You need to use a method name DisplayResult to display the result when the database update is complete. Which code segment should you use?

You are creating a Windows Forms application. You implement the asynchronous design pattern by using a delegate named DataUpdateHandler. DataUpdateHandler executes a method named DataUpdater. You create an instance of the DataUpdateHandler that has the variable name Updater. DataUpdater uses a DataSet class as a parameter and returns an integer value that indicates the number of rows that have been updated. You need to use a method name DisplayResult to display the result when the database update is complete. Which code segment should you use?

A.
IAsyncResult result = Update .BeginInvoke(mData, null,null); //…
int value = (int)result.AsyncState;
DisplayResult(value);

B.
IAsyncResult result = Update .BeginInvoke(mData, null,null); //…
int value = Updater.EndInvoke(result);
DisplayResult(value);

C.
IAsyncResult result = Update .BeginInvoke(mData, null "DisplayResults"); //…
Updater.EndInvoke(result);

D.
IAsyncResult result = Update .BeginInvoke(mData, null "DataUpdater"); //…
Updater.EndInvoke(result);



Leave a Reply 0

Your email address will not be published. Required fields are marked *