Exemplo n.º 1
0
        public static Task <T> NextValueAsync <T>(this ISource <T> source, Lifetime lifetime)
        {
            var tcs = lifetime.CreateTaskCompletionSource <T>();

            source.AdviseOnce(lifetime, v =>
            {
                tcs.TrySetResult(v);
            });
            return(tcs.Task);
        }