private static IReadOnlyCollection<string> ReadAllLines(ITextFile textFile) { using (SystemMode.Reader) // don't remove this - that's cheating! { return textFile.ReadLines().ToList(); } }
public void Add(ITextFile textFile) { foreach (string line in textFile.ReadLines()) { totaliser.Add(line); } }
private void Process(ITextFile textFile) { foreach (string line in textFile.ReadLines()) { textLineQueue.Add(line); } }
private static IReadOnlyCollection <string> ReadAllLines(ITextFile textFile) { using (SystemMode.Reader) // don't remove this - that's cheating! { return(textFile.ReadLines().ToList()); } }
/// <inheritdoc /> /// <exception cref="ArgumentNullException"> /// Thrown if the passed argument is /// full /// </exception> public void Parse(ITextFile file) { if (file is null) { throw new ArgumentNullException(nameof(file)); } this.ParseLineByLine(file.ReadLines()); }
private ICharacterCounter ComputeCharCounts(ITextFile textFile) { ++NumberOfCallsToComputeCharCounts; var counter = new CharacterTotaliser(); foreach (string line in textFile.ReadLines()) { counter.Add(line); } return counter; }
private ICharacterCounter ComputeCharCounts(ITextFile textFile) { ++NumberOfCallsToComputeCharCounts; var counter = new CharacterTotaliser(); foreach (string line in textFile.ReadLines()) { counter.Add(line); } return(counter); }
public void Add(ITextFile textFile) { // We could possibly put the lock around just Add(), but would then incur a lot of lock-entry/exit // time. It could sometimes be better, but this way probably wins most times. readerWriterLock.EnterWriteLock(); try { foreach (string line in textFile.ReadLines()) { totaliser.Add(line); } } finally { readerWriterLock.ExitWriteLock(); } }
public IEnumerable <string> ReadLines() { return(textFile.ReadLines()); }