Passing parameter into a Task.Factory.StartNew
问题 Given the following code: string injectedString = "Read string out of HttpContext"; Task.Factory.StartNew(() => { MyClass myClass = new MyClass(); myClass.Method(injectedString); } Is this the best way to pass the string into the Task/Thread? My concerns with this method are: Would the garbage collector know when the string became out of context and clean it up correctly? Is there a better way to inject dependencies into a Task breaking the link to the object in the main thread? This is in a