コード例 #1
0
ファイル: Futures.cs プロジェクト: ddd-cqrs-es/must
        /// <summary>
        /// Creates a <see cref="IFuture{T}"/> which has its value set
        /// immediately upon construction.
        /// </summary>
        /// <param name="value">The value that the returned future shoud hold.</param>
        /// <returns>A <see cref="IFuture{T}"/> whose value is
        /// <paramref name="value"/> and is in the completed state.</returns>
        /// <remarks>
        /// The getters just return the value. This
        /// <see cref="IFuture{T}"/> can't be cancelled or timed out and its
        /// <see cref="IFuture{T}.IsCompleted"/> property always returns
        /// <c>true</c>.
        /// </remarks>
        public static IFuture <T> ImmediateFuture <T>(T value)
        {
            SettableFuture <T> future = new SettableFuture <T>();

            future.Set(value, true);
            return(future);
        }