If i have two arrays
First: A, B, C
Second: ?, B, C
I want to compare only items from Second with items from First which is does not contains question mark “?”.
So for such case:
First: A, B, C
Second: ?, B, C
I wan to compare just items 1 and 2 because item 0 in the Second array contains ?.
For that one:
First: A, B, C
Second: 2, ?, C
I want to compare only items 0 and 2 because item 1 in Second array contains ?
Any ideas how better and with minimum amount of code to do that? If it would required to create any lists or any another collections that is fine.
Using LINQ from the comfort of your armchair:
Update:
If the comparison predicate (the method that compares a pair of items and returns a boolean) is going to be more complicated than the above, it makes sense to define it either as a lambda (if it’s not going to be reused and it’s short enough) or as a proper method otherwise.
For example, to implement what’s mentioned in a comment below: