CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: foreach loops

Threaded View

  1. #1
    Join Date
    Dec 2008
    Posts
    31

    foreach loops

    Hi,

    I have a Lists of certain objects, and am looping through all combos of them like

    foreach(object o1 in theobjects){
    foreach(object o2 in theobjects){
    foreach(object o3 in the objects){
    }
    }
    }

    However I dont want to double up on myself, e.g. o1[element 1]o2[element 1]o3[element 2], can be regarded as the same as o1[element 1]o2[element 2]o3[element 1], (i.e. switching the last two etc).

    I just want to consider o1[element 1]o2[element 2]o3[element 3],o1[element 2]o2[element 1]o3[element 3],o1[element 3]o2[element 1]o3[element 2]

    Hope this makes sense...
    Last edited by Bobby_1234; January 18th, 2009 at 07:33 PM.

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