Task |
The TaskCollection type exposes the following members.
| Name | Description | |
|---|---|---|
| Count | Gets the number of registered tasks in the collection. | |
| ItemInt32 | Gets the specified registered task from the collection. | |
| ItemString | Gets the named registered task from the collection. |
| Name | Description | |
|---|---|---|
| Dispose | Releases all resources used by this class. | |
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) | |
| Exists | Determines whether the specified task exists. | |
| Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object) | |
| GetEnumerator | Gets the collection enumerator for the register task collection. | |
| GetHashCode | Serves as the default hash function. (Inherited from Object) | |
| GetType | Gets the Type of the current instance. (Inherited from Object) | |
| MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object) | |
| ToString | Returns a String that represents this instance. (Overrides ObjectToString) |
public class Program { bool RootFolderHasTask(string taskName) { if (TaskService.Instance.RootFolder.Tasks.Count > 0) { return TaskService.Instance.RootFolder.Tasks.Exists(taskName); } return false; } TaskCollection GetRootTasksStartingWith(string value) { var pattern = $"^{Regex.Escape(value)}.*$"; return TaskService.Instance.RootFolder.GetTasks(new Regex(pattern)); } public static void Main() { foreach (var task in GetRootTasksStartingWith("MyCo")) if (RootFolderHasTask(task.Name)) Console.WriteLine(task.Name); } }