Exemple #1
0
        public static bool TryCreate(TextLineCollection lines, TextSpan span, out TextLineCollectionSelection selection)
        {
            selection = null;

            if (lines.Count == 0)
            {
                return(false);
            }

            (int startIndex, int endIndex) = GetIndexes(lines, span);

            if (startIndex == -1)
            {
                return(false);
            }

            selection = new TextLineCollectionSelection(lines, span, startIndex, endIndex);
            return(true);
        }
 internal static bool TryCreate(TextLineCollection lines, TextSpan span, int minCount, int maxCount, out TextLineCollectionSelection selectedLines)
 {
     selectedLines = Create(lines, span, minCount, maxCount);
     return(selectedLines != null);
 }
 /// <summary>
 /// Creates a new <see cref="TextLineCollectionSelection"/> based on the specified list and span.
 /// </summary>
 /// <param name="lines"></param>
 /// <param name="span"></param>
 /// <param name="selectedLines"></param>
 /// <returns>True if the specified span contains at least one line; otherwise, false.</returns>
 public static bool TryCreate(TextLineCollection lines, TextSpan span, out TextLineCollectionSelection selectedLines)
 {
     selectedLines = Create(lines, span, 1, int.MaxValue);
     return(selectedLines != null);
 }
 internal EnumeratorImpl(TextLineCollectionSelection selection)
 {
     _en = new Enumerator(selection);
 }
 internal Enumerator(TextLineCollectionSelection selection)
 {
     _selection = selection;
     _index     = -1;
 }