System.Threading.Tasks.TaskScheduler.TryExecuteTask C# (CSharp) Method

TryExecuteTask() protected method

protected TryExecuteTask ( System.Threading.Tasks.Task task ) : bool
task System.Threading.Tasks.Task
return bool
		internal protected bool TryExecuteTask (Task task)
		{
			throw new NotSupportedException ();
		}

Usage Example

Beispiel #1
0
        public void RunSynchronously(TaskScheduler scheduler)
        {
            if (this.Status != TaskStatus.Created)
            {
                throw new InvalidOperationException("The task is not in a valid state to be started");
            }
            if (scheduler.TryExecuteTask(this))
            {
                return;
            }

            Start(scheduler);
            Wait();
        }