[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
Re: [2.0] C# Combining Collections Using AND
An array and a collection are two different things, so you should be careful with your terminology. From your use of the square brackets it would seem that you are using arrays. Is that the case, because they are different types and thus have different properties and methods and thus will have to be treated differently?