public Task <IBinding> TryCreateAsync(BindingProviderContext context)
        {
            ParameterInfo parameter = context.Parameter;

            if (parameter.ParameterType != typeof(CancellationToken))
            {
                return(Task.FromResult <IBinding>(null));
            }

            IBinding binding = new CancellationTokenBinding(parameter.Name);

            return(Task.FromResult(binding));
        }
        public Task<IBinding> TryCreateAsync(BindingProviderContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            ParameterInfo parameter = context.Parameter;

            if (parameter.ParameterType != typeof(CancellationToken))
            {
                return Task.FromResult<IBinding>(null);
            }

            IBinding binding = new CancellationTokenBinding(parameter.Name);
            return Task.FromResult(binding);
        }
예제 #3
0
        public Task <IBinding> TryCreateAsync(BindingProviderContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            ParameterInfo parameter = context.Parameter;

            if (parameter.ParameterType != typeof(CancellationToken))
            {
                return(Task.FromResult <IBinding>(null));
            }

            IBinding binding = new CancellationTokenBinding(parameter.Name);

            return(Task.FromResult(binding));
        }