Converting between C# List and F# List -


remark: self-documentation, if have other suggestions, or if made mistakes/miss out obvious, appreciate help.

sources:

convert .net generic list f# list

what can pass list c# f#?

https://msdn.microsoft.com/en-us/library/4kf43ys3(v=vs.110).aspx?cs-save-lang=1&cs-lang=fsharp#code-snippet-1


i beginner in f# , c#, , want convert c# list f# list, , vice versa. code/commands doing changes depending on code (in c# or f#).

please see answer below. if have other suggestions, please let me know. thank you.

inside c# document, can use listmodule.ofseq , .tolist(), this:

// inside c# document var cs_list = new list<int> {1,2,3};  var fs_list = listmodule.ofseq(cs_list); // microsoft.fsharp.collections.listmodule var cs_converted_back = fs_list.tolist(); 

inside f# document, can use seq.tolist , resizearray<_>, this:

// inside f# document let fs_list = [1;2;3] let cs_list = resizearray<int> fs_list // system.collections.generic.list let fs_converted_back = seq.tolist cs_list 

if made mistakes, or if miss out obvious, please let me know.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -