CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2008
    Posts
    61

    Question List of List<UInt64>

    I do have
    Code:
    List<UInt64> MyList = new List<UInt64>();
    But how do I create a List for adding several 'MyList's ?

  2. #2
    Join Date
    May 2003
    Location
    Germany
    Posts
    936

    Re: List of List<UInt64>

    Try this:
    Code:
    public class MyList: List<UInt64>
    {}
    
    
    List<MyList> myLists = new List<MyList>();
    Useful or not? Rate my posting. Thanks.

  3. #3
    Join Date
    May 2007
    Posts
    1,546

    Re: List of List<UInt64>

    Or you can avoid creating a new class and just do:

    List<List<uint>> listoflists = new List<List<uin>>();
    www.monotorrent.com For all your .NET bittorrent needs

    NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling.

  4. #4
    Join Date
    Mar 2007
    Posts
    375

    Re: List of List<UInt64>

    Why don't you use two-dimensional arrays? They work about the same way.

    Code:
    uint[,] MyList = new MyList[10, 10];
    That list would have 10 rows with 10 uints in each. The down-part is that you have to specify the number of values at creation.
    Please vote the posts you find usefull.

    ---

    I'm back
    Bigger and badder
    Better and bolder
    Explaining stuff -
    With an improved vocabulary!

  5. #5
    Join Date
    Mar 2004
    Location
    Prague, Czech Republic, EU
    Posts
    1,701

    Re: List of List<UInt64>

    Why not? Becase array and collection are two different things.
    • Make it run.
    • Make it right.
    • Make it fast.

    Don't hesitate to rate my post.

  6. #6
    Join Date
    Jan 2008
    Posts
    61

    Re: List of List<UInt64>

    Quote Originally Posted by dahwan
    Why don't you use two-dimensional arrays? They work about the same way.

    Code:
    uint[,] MyList = new MyList[10, 10];
    That list would have 10 rows with 10 uints in each. The down-part is that you have to specify the number of values at creation.
    Because i don't know the size of collection and it can (will) grow I can't use a fixed arraysize but must use a 'growable' collection

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured