Skip to content

2.1 IParsedFile

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

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

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

  • IParsedLine NextLine()

Extracts next IParsedFile line, modifying it.

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

  • IParsedLine PeekNextLine()

Extracts next IParsedFile line, without modifying it.

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

  • List<T> ToList<T>(string lineSeparator = null)

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

If a lineSeparator is selected, chosen string will be added after last item of every line.

  • string ToSingleString(string wordSeparator = " ", string lineSeparator = null)

Returns remaining file items as a single string.

If a lineSeparator is selected, chosen string will be added to after last item of every line.

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 lines) of IParsedFile.

  • bool Empty { get; }

Returns true if IParsedFile has no remaining lines.

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