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);
        }
Esempio n. 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));
        }