Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use generic version of IEnumerable in CsvParser.cs #84

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 19 additions & 4 deletions src/managed/LocUtil/CsvParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;

namespace LocUtil
{
public class CsvParser : IEnumerable, IDisposable
public class CsvParser : IEnumerable<string[]>, IDisposable
{
private readonly TextReader _input;
private bool _atLineEnd = false;
Expand Down Expand Up @@ -147,7 +148,7 @@ public void Dispose()
_input.Close();
}

private class LineEnumerator : IEnumerator
private class LineEnumerator : IEnumerator<string[]>
{
CsvParser parent;
string[] line;
Expand Down Expand Up @@ -181,15 +182,29 @@ public void Reset()
throw new NotSupportedException();
}

public object Current
public void Dispose()
{
}

public string[] Current
{
get { return line; }
}

object IEnumerator.Current
{
get { return line; }
}
}

public IEnumerator GetEnumerator()
public IEnumerator<string[]> GetEnumerator()
{
return new LineEnumerator(this);
}

IEnumerator IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
}
}