Ejemplo n.º 1
0
        /// <summary>
        /// Creates an object representing binding information for await operations.
        /// </summary>
        /// <param name="awaitableType">The type of the awaitable object.</param>
        /// <returns>An object representing binding information for await operations.</returns>
        public static StaticAwaitInfo AwaitInfo(Type awaitableType)
        {
            ContractUtils.RequiresNotNull(awaitableType, nameof(awaitableType));

            var getAwaiterMethod = GetGetAwaiter(awaitableType);

            if (getAwaiterMethod == null)
            {
                throw Error.AwaitableTypeShouldHaveGetAwaiterMethod(awaitableType);
            }

            return(AwaitInfo(awaitableType, getAwaiterMethod));
        }