namespace XGame.Framework.Asyncs
{
    public class AwaiterResultable<TResult> : Awaiter, IAsyncResultable<TResult>
    {
        TResult _Result;
        public TResult Result => _Result;

        public override void Completed(IAsync result)
        {
            if (result is IAsyncResultable<TResult>)
                _Result = (result as IAsyncResultable<TResult>).Result;
            base.Completed(result);
        }
    }
}