I followed the link to parse CSV using F # and filehelpers . got a compiler error for the following code"The record class oneRow need a constructor with no args (public or private)"
[<DelimitedRecord(",")>]
type oneRow=
class
[<FieldConverter(ConverterKind.Date, "M/d/yyyy")>]
val date: DateTime
val value: bool
end
let engine = new FileHelperEngine(typeof<oneRow>)
let tmp = engine.ReadFile("test.csv")
EDIT
The solution looks rather verbose than the C # version. I need to add (), mutableand[<DefaultValue>]
type oneRow() =
class
[<FieldConverter(ConverterKind.Date, "M/d/yyyy")>]
[<DefaultValue>]
val mutable date: DateTime
[<DefaultValue>]
val mutable value: bool
end
But similar code works in C # without specifying a constructor. Can someone help me fix the F # code? Thank you
source
share