How can I cancel a Task without LOOP
问题 Hi I've been reading alot on the forum but I'm not able to find the answer to my problem... Here's my function that I want to cancel when a boolean turn to TRUE: Task<PortalODataContext> task = Task.Factory.StartNew(() => { var context = connection.ConnectToPortal(); connection.ListTemplateLib = this.ShellModel.ConnectionManager.GetTemplateLibrarys(connection); connection.ListTemplateGrp = this.ShellModel.ConnectionManager.GetTemplateGroups(connection, connection.TemplateLibraryId);