我正在创建一个将被C#代码使用的模块,所以我不想直接返回LazyList<>。如果我这样做了,C#将不得不引用FSharp.PowerPack,这似乎很奇怪。
所以我宁愿返回一个IList<>,但是当我尝试这样做时:
let x = LazyList.ofSeq {0..10}
let y = x :> IList<int32>但是,这给了我一个错误:
The type 'LazyList<int> is not compatible with the type 'IList<int>'这使我相信,LazyList<>并不是implement IList<>。这是真的吗?
我遗漏了什么?
发布于 2013-10-28 15:37:34
的确,LazyList没有实现IList接口。不过,它实现了IEnumerable。
[<Sealed>]
type LazyList<'T> =
interface IEnumerable<'T>
interface System.Collections.IEnumerablehttps://stackoverflow.com/questions/19638724
复制相似问题