Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6859209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:15:16+00:00 2026-05-27T02:15:16+00:00

this is an extension of my previous thread . I thought that accessing a

  • 0

this is an extension of my previous thread.
I thought that accessing a List<List<>> would be quite similar to a simple list, but I have some problem.

Here’s the F# code:

type X = 
    {
        valuex : int
    }
let l = 
    [
    for i in 1 .. 10 -> 
        [
        for j in 1 .. 10 ->
            {valuex =  i * j}
        ]

    ]

Accordingly to my previous post I tried to do the following inside C# code:

IList<IList<MyModule.X>> list = MyModule.l.ToList();

but this don’t compile.
Can someone which is my error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:15:16+00:00Added an answer on May 27, 2026 at 2:15 am

    In this case, the type of the property is FSharpList<FSharpList<MyModule.X>> So you’ll have to map each inner FSharpList to an IList<T> and then materialize the resulting sequence to a list (of lists).

    This would look like:

    IList<IList<MyModule.X>> list = MyModule.l
                                            .Select(inner => (IList<MyModule.X>) inner.ToList())
                                            .ToList();
    

    Do you really need all these precise conversions? Isn’t the fact that the collection is already an IEnumerable<IEnumerable<T>> good enough? In fact, FSharpList<T> itself is quite a usable type from C#, so I would stay away from these conversions unless absolutely necessary.

    EDIT:

    If you just need to iterate the elements, all you need is a loop:

    foreach(var innerList in MyModule.l)
    {
        foreach(var item in innerList)
        {
            Console.WriteLine(item.valuex);
        }     
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is an extension to a previous question which was answered. But have a
This is an extension of a previous question I asked. I ran into some
(Note: This is an extension of a previous question .) I am having some
This is a question that is an extension of my previous Free 3 of
Hello every one this is basically extension to my previous question. i have write
this question is an extension of my previous question that you can find here:
I have some redirects in place from our previous site that used CakePHP. The
this question is an extension to a previous question i asked (and was answered).
The CollectionViewSource.GetDefaultView() method is not in Silverlight 3. In WPF I have this extension
For those of you that use Mercurial with the MQ extension: This is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.