本文整理汇总了C#中ITask.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# ITask.GetHashCode方法的具体用法?C# ITask.GetHashCode怎么用?C# ITask.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITask
的用法示例。
在下文中一共展示了ITask.GetHashCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InternalAdd
private void InternalAdd(ITask task, bool throwIfContains)
{
if (task.Dependencies != null)
foreach (ITask dependency in task.Dependencies)
{
if (dependency.Parent != task)
throw new ArgumentOutOfRangeException("task", "Parent value set invalid, probably task contained as dependency for several other tasks");
InternalAdd(dependency, false);
}
lock (_sync)
{
if (InternalContains(task))
{
if (throwIfContains)
throw new ArgumentException("Task already added");
return;
}
// remember the task for further execution:
task.StatusChanged += TaskStatusChanged;
_queue.Add(task);
_shadowQueue.Add(task.GetHashCode(), task);
_count = _queue.Count;
}
Event.Invoke(TaskAdded, this, new TaskAddedEventArgs(this, task));
}
示例2: RemoveTask
private void RemoveTask(ITask task)
{
task.StatusChanged -= TaskStatusChanged;
if (task == _currentTask)
{
ClearCurrent();
}
else
{
lock (_sync)
{
if (InternalContains(task))
{
_queue.Remove(task);
_shadowQueue.Remove(task.GetHashCode());
_count = _queue.Count;
}
}
}
}
示例3: InternalContains
private bool InternalContains(ITask task)
{
return _shadowQueue.ContainsKey(task.GetHashCode());
}