PathAction GetPathStart() { var action = PathActions.Where(p => p.Verb == VerbType.Close).LastOrDefault(); if (action.Verb == VerbType.Close) { var index = PathActions.IndexOf(action); if (index < PathActions.Count - 1 && PathActions[index + 1].Verb == VerbType.Move) { index++; } return(PathActions[index]); } return(PathActions[0]); }
PathAction GetPathStart() { //var action = PathActions.Where(p => p.Verb == VerbType.Close).LastOrDefault(); PathAction action = default; for (var i = PathActions.Count - 1; i >= 0; i--) { action = (PathAction)PathActions[i]; break; } if (action.Verb == VerbType.Close) { var index = PathActions.IndexOf(action); if (index < PathActions.Count - 1 && ((PathAction)PathActions[index + 1]).Verb == VerbType.Move) { index++; } return((PathAction)PathActions[index]); } return((PathAction)PathActions[0]); }