3 people like it.

IEnumerator

seq to IEnumerator and IEnumerable

1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
type YourType () =
    interface IEnumerable<'T> with
        member r.GetEnumerator () =
            let s = seq {}
            s.GetEnumerator()
    interface IEnumerable with
        member r.GetEnumerator () =
            (r:>IEnumerable<'T>).GetEnumerator():>IEnumerator
Multiple items
type YourType =
  interface obj
  interface obj
  new : unit -> YourType
  override GetEnumerator : unit -> IEnumerator<'b>
  override GetEnumerator : unit -> 'a

Full name: Script.YourType

--------------------
new : unit -> YourType
val r : YourType
override YourType.GetEnumerator : unit -> System.Collections.Generic.IEnumerator<'b>

Full name: Script.YourType.GetEnumerator
val s : seq<'b>
Multiple items
val seq : sequence:seq<'T> -> seq<'T>

Full name: Microsoft.FSharp.Core.Operators.seq

--------------------
type seq<'T> = System.Collections.Generic.IEnumerable<'T>

Full name: Microsoft.FSharp.Collections.seq<_>
System.Collections.Generic.IEnumerable.GetEnumerator() : System.Collections.Generic.IEnumerator<'b>
override YourType.GetEnumerator : unit -> 'a

Full name: Script.YourType.GetEnumerator
Raw view Test code New version

More information

Link:http://fssnip.net/cS
Posted:12 years ago
Author:Graham Spiers
Tags: seq , ienumerator , ienumerable