Additional questions F #. The following is a binary read implementation. I want it to work as an enumerated sequence. The code below gives me the following error, and I, as usual, do not know how to solve it. I have a C # implementation where I had to implement two different overrides for a property .Current. I think I should do the same here, but I donβt know how to do it. As always, thanks for the million for your help.
error FS0366: for Collections.IEnumerator.get_Current() : objnot implemented implementation. Note that all interface members must be implemented and listed in the corresponding declaration interface, for example. interface ... with member ....
namespace persisitence
open System.Collections.Generic
open System
open System.IO
type BinaryPersistenceIn<'T>(fn: string, serializer: ('T * BinaryReader) -> unit) as this =
let stream_ = File.Open(fn, FileMode.Open, FileAccess.Read)
let reader_ = new BinaryReader(stream_)
[<DefaultValue>] val mutable current_ : 'T
let eof() =
stream_.Position = stream_.Length
interface IEnumerator<'T> with
member this.MoveNext() =
let mutable ret = eof()
if stream_.CanRead && ret then
serializer(this.current_, reader_)
ret
member this.Current
with get() = this.current_
member this.Dispose() =
stream_.Close()
reader_.Close()
member this.Reset() =
stream_.Seek((int64) 0., SeekOrigin.Begin) |> ignore
source
share