Skip to content

2.2 IParsedLine

Eduardo Cáceres edited this page Dec 25, 2018 · 2 revisions

This interface allows users to extract information from a line, item by item.

Objects implementing it are supposed to store internally the whole parsed line.

  • T NextElement<T>();

Extracts next IParsedLine item, modifying it.

This means that a future NextElement() invocation will return following item, as it's usually desired.

  • T PeekNextElement<T>()

Extracts next IParsedLine item, without modifying it.

This means that consecutive PeekNextElement() invocations will return the same information.

  • List<T> ToList<T>()

Returns remaining line items as a list, providing they're all of the same type.

  • string ToSingleString(string wordSeparator = " ")

Returns remaining line items as a single string.

If a wordSeparator is selected, chosen string will be added after every word. By default, a blank space is added, but using string.Empty() can be explicitly used to avoid those blank spaces.

  • int Count { get; }

Returns the size (remaining number of items) of IParsedLine.

  • bool Empty { get; }

Returns true if IParsedLine has no remaining items.

Using Empty intends to perform better than comparing Count result against zero.