public ISegment GetNextReplaceableActiveElement(bool stopWhenReachOut = true) { if (Context != null && IsSnippetActivated) { bool isCurrent = false; foreach (IActiveElement element in Context.ActiveElements) { ReplaceableActiveElement re = element as ReplaceableActiveElement; if (re != null) { if (_activeElement == null) { _activeElement = re; IsSnippetActivated = true; return(re.Segment); } else { if (_activeElement.Equals(re)) { isCurrent = true; } else if (isCurrent) { _activeElement = re; IsSnippetActivated = true; return(re.Segment); } } } } } if (stopWhenReachOut) { return(_activeElement.Segment); } else { _activeElement = null; IsSnippetActivated = false; return(null);//제일 마지막까지 갔는데 없다면 모든 Active snippet을 돈 것이다. } }