private Tuple <Position, int>[] GetSelections() { var selectionsCount = scintilla.GetSelections(); var selections = new List <Tuple <Position, int> >(selectionsCount); for (int i = 0; i < selectionsCount; i++) { var selectionStart = scintilla.GetSelectionNStart(i); var delta = (scintilla.GetSelectionNEnd(i) - selectionStart).Value; selections.Add(Tuple.Create(selectionStart, delta)); } return(selections.OrderByDescending(x => x.Item1.Value).ToArray()); }