I made a function in F#
let tryParseArray tryParse (separator:char) (line: string) =
// inside the function I use the tuple form of tryParse
It works fine if I call it in such way: tryParseArray Int32.TryParse ',' "2,3,2,3,2"
Now I would like this function to be available in C# as well, so I did this:
static member TryParseArray (line, tryParse, separator) =
line |> tryParseArray tryParse separator
Then I realized that TryParseArray
actually takes tryParse
argument as FSharpFunc
, which is not friendly to C# at all, so I tried this:
static member TryParseArray (line, [<Out>] tryParse: (string * byref<'a> -> bool), separator) =
line |> tryParseArray tryParse separator
but now tryParseArray
doesn't accept tryParse
as a valid argument (type error)
What should I do?
I wish in C# I can call TryParseArray("2,3,2,3,2", Int32.TryParse, ',')
as well