protected virtual void Dispose(bool disposing) { if (disposing) { if ((this.Options & 0x4000) != TaskCreationOptions.None) { return; } if (!this.IsCompleted) { throw new InvalidOperationException(Environment.GetResourceString("Task_Dispose_NotCompleted")); } ContingentProperties contingentProperties = this.m_contingentProperties; if (contingentProperties != null) { ManualResetEventSlim completionEvent = contingentProperties.m_completionEvent; if (completionEvent != null) { contingentProperties.m_completionEvent = null; if (!completionEvent.IsSet) { completionEvent.Set(); } completionEvent.Dispose(); } } } this.m_stateFlags |= 0x40000; }
Task.Factory.StartNew(()=>{ .. some stufff });
using
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)