Quantcast
Channel: Task Scheduler Managed Wrapper
Viewing all articles
Browse latest Browse all 2206

New Post: How to disable task scheduler in c#

$
0
0
If you are putting TaskService inside a using clause like the following, you cannot use the variable outside the brackets.
using (TaskService ts = new TaskService())
{
   // All references to "ts" must be here. Outside of the brackets for the using clause, any reference to "ts" will cause errors.
}
If you hold onto an instance of TaskService, then you must instantiate it and dispose of it manually.
class MyClass : IDisposable
{
   private TaskService ts;

   public MyClass()
   {
      ts = new TaskService();
   }

   void Dispose()
   {
      ts.Dispose();
      ts = null;
   }

   public void DoSomething()
   {
      ts.RootFolder.CreateFolder("NewFolder");
   }
}

Viewing all articles
Browse latest Browse all 2206

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>