let reader = selectCommand.ExecuteReader() let getBytesData (x : IDataReader) = 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 = Array.zeroCreate (int32 len) x.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 for reading bytes [] from datareader.
The getBytesData function takes the reader and returns bytes [] from the reader.
- everything works fine, but the getBytesData function works very dysfunctionally.
- I create a null filled byte array just to create an array, is there a way to create a dynamic expandable or fixed long array
Is there a way that I can optimize in F #?
Sorry for some question, but I started a new project in F # to squeeze all the juice out of it, so trying to get each line in the most optimal way
source share