将.NET通用列表转换为F#列表 [英] convert .NET generic List to F# list

查看:92
本文介绍了将.NET通用列表转换为F#列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在将.NET列表转换为F#列表的内置方法?

Is there a built-in method to convert the .NET List<> into the F# list?

推荐答案

尝试 Microsoft.FSharp.Collections名称空间中的strong> List.ofSeq .

Try List.ofSeq in the Microsoft.FSharp.Collections namespace.

#                     List.ofSeq : seq<'T> -> 'T list

它不是专门用于System.Collections.Generic.List<T>,而是通常用于IEnumerable<T>(在F#中为seq<'T>)类型,因此它仍然可以工作.

It's not specifically for System.Collections.Generic.List<T>, but for IEnumerable<T> (seq<'T> in F#) types in general, so it should still work.

(它也不是F#语言的严格内置工具,但List<T>也不是C#或VB.NET内置工具.它们都是各自标准库的一部分.)

(It's also not strictly built into the F# language, but neither is List<T> built into C# or VB.NET. Those are all part of the respective standard libraries.)

这篇关于将.NET通用列表转换为F#列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆