F# working with DataReader
Posted
by mamu
on Stack Overflow
See other posts from Stack Overflow
or by mamu
Published on 2010-06-06T04:27:44Z
Indexed on
2010/06/06
4:32 UTC
Read the original article
Hit count: 415
F#
let getBytesData x =
let len = reader.GetBytes(1, int64 0, null, 0, 0);
// Create a buffer to hold the bytes, and then
// read the bytes from the DataTableReader.
let buffer : byte array = [||]
reader.GetBytes(1, int64 0, buffer, 0, int32 len) |> ignore
buffer
let retVal = List [ while reader.Read() do yield (reader.GetString(0), getBytesData reader, reader.GetDateTime(2)) ]
I have above code to read bytes[] from datareader.
getBytesData function takes reader and returns bytes[] from reader.
everything works fine but it getBytesData function is working very non-functional way.
Is there any way i can optimize in F#?
Sorry for kind of question, but i have started a new project on F# to squeeze all juice out of it, so trying to get each line most optimal way
© Stack Overflow or respective owner