Example/Program.cs

(完整代码) 734B

// The parser does not Close (Dispose) the StreamReader.
// The calling code is responsible, so we add `using` here.
using var sr = new StreamReader("test1.csv");

var parser = new SmallestCSV.SmallestCSVParser(sr);

// Set this to true if you don't care about preserving the quotes around fields.
// (Sometimes that is used to distinguish a null vs empty field.)
const bool removeEnclosingQuotes=false;

while (true) {
    List<string>? columns = parser.ReadNextRow(removeEnclosingQuotes:removeEnclosingQuotes);
    if (columns == null) {
        Console.WriteLine("End of file reached");
        break;
    }
    var prettyRow = System.Text.Json.JsonSerializer.Serialize(columns);
    Console.WriteLine($"Read row: {prettyRow}");
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。