public void Cancel(object AnimationObject) { lock (SyncObject) { if (AnimationTargets.Count == 0) { return; } var node = AnimationTargets.Head; while (node != null && node.Value.AnimationObject != AnimationObject) { node = node.Next; } if (node != null) { AnimationTargets.Remove(node); } } }