Exemple #1
0
        static void Print(DoMethod m, double a, double b)
        {
            double res = m(a, b);

            Console.Write($" = {res}");
        }
Exemple #2
0
 public string ProcessWithMethod(string sourceString, DoMethod dm)
 {
     return(dm(sourceString));
 }
        private void ProcessLines(DoMethod action)
        {
            using (IDisposable undoGroup = UndoOpenGroup())
            {
                UndoSaveSelection();

                int selectEndLine = SelectionEndLine;
                if ((SelectionStartLine != SelectionEndLine) && (SelectionEndCharPlusOne == 0))
                {
                    selectEndLine--;
                }
                bool savedStartIsActive = SelectionStartIsActive;

                SetSelection(
                    SelectionStartLine,
                    0,
                    selectEndLine,
                    GetLine(selectEndLine).Length,
                    SelectionStartIsActive);

                ITextStorage text = this.SelectedTextStorage;

                action(text);

                ReplaceRangeAndSelect(
                    SelectionStartLine,
                    SelectionStartChar,
                    SelectionEndLine,
                    SelectionEndCharPlusOne,
                    text,
                    0);
                if (savedStartIsActive != SelectionStartIsActive)
                {
                    SwapEnd();
                }
            }
        }