How read a file into a seq of lines in F#

后端 未结 6 1883
深忆病人
深忆病人 2020-12-12 20:21

This is C# version:

public static IEnumerable ReadLinesEnumerable(string path) {
  using ( var reader = new StreamReader(path) ) {
    var line         


        
6条回答
  •  被撕碎了的回忆
    2020-12-12 21:01

    On .NET 2/3 you can do:

    let readLines filePath = File.ReadAllLines(filePath) |> Seq.cast
    

    and on .NET 4:

    let readLines filePath = File.ReadLines(filePath);;
    

提交回复
热议问题