System.ComponentModel.Async.Complete C# (CSharp) Method

Complete() public method

Completes the associated task with the specified error.
public Complete ( Exception error ) : void
error Exception The error that occurred while completing the task.
return void
        public void Complete(Exception error)
        {
            Complete(GetDefaultResult(), error);
        }

Same methods

Async::Complete ( object result ) : void
Async::Complete ( object result, Exception error ) : void

Usage Example

Example #1
0
        public Async<Profile> GetProfile(string userName)
        {
            Async<Profile> asyncProfile = new Async<Profile>();

            _twitterService.GetProfile(userName, delegate(Profile profile) {
                if (profile == null) {
                    asyncProfile.Complete(new Exception("The profile for '" + userName + "' could not be loaded."));
                }
                else {
                    asyncProfile.Complete(profile);
                }
            });

            return asyncProfile;
        }
All Usage Examples Of System.ComponentModel.Async::Complete