Results 1 to 2 of 2

Thread: [2.0] C# Combining Collections Using AND

Threaded View

  1. #1

    Thread Starter
    Addicted Member señorbadger's Avatar
    Join Date
    Oct 2003
    Location
    Mud pools of wellingborough
    Posts
    193

    Question [2.0] C# Combining Collections Using AND

    Hello, I think this is more of a maths issue but here goes...

    I am trying to write a method where if i pass in a collection of a collection of "Customer" objects it will compare them by ID number to return a colleciton of objects using (AND) ie only if the ID number appears in all of them.

    Example expected

    Input:

    clsCustomer[][]
    |
    |---------- clsCustomer[]
    | |
    | |----- clsCustomer {ID = 1; FORENAME = "BOB"...}
    | |----- clsCustomer {ID = 2; FORENAME = "BILL"...}
    | |----- clsCustomer {ID = 3; FORENAME = "JOHN"...}
    |
    |---------- clsCustomer[]
    | |
    | |----- clsCustomer {ID = 1; FORENAME = "BOB"...}
    | |----- clsCustomer {ID = 2; FORENAME = "BILL"...}
    | |----- clsCustomer {ID = 4; FORENAME = "Hannah"...}
    | |----- clsCustomer {ID = 3; FORENAME = "JOHN"...}
    |
    |---------- clsCustomer[]
    | |
    | |----- clsCustomer {ID = 1; FORENAME = "BOB"...}
    | |----- clsCustomer {ID = 4; FORENAME = "Hannah"...}
    | |----- clsCustomer {ID = 5; FORENAME = "Vicky"...}
    | |----- clsCustomer {ID = 3; FORENAME = "JOHN"...}

    If this was fed into the method the collection below would be returned

    clsCustomer[]

    clsCustomer {ID = 1; FORENAME = "BOB"...}
    clsCustomer {ID = 3; FORENAME = "JOHN"...}

    because they appear in all of the input arrays

    Any help would be appriciated, source code would be handy

    Thanks all
    Last edited by señorbadger; Apr 26th, 2006 at 03:06 AM.

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