AsyncResult<TResult>
Base class to encapsulates the results of an asynchronous operation that returns result.
using System;
namespace Renci.SshNet.Common
{
public abstract class AsyncResult<TResult> : AsyncResult
{
private TResult _result;
protected AsyncResult(AsyncCallback asyncCallback, object state)
: base(asyncCallback, state)
{
}
public void SetAsCompleted(TResult result, bool completedSynchronously)
{
_result = result;
SetAsCompleted(null, completedSynchronously);
}
public new TResult EndInvoke()
{
base.EndInvoke();
return _result;
}
}
}