0

Lets have a class called "ClassA" and lets have the following code:

...
ClassA[,] all = new ClassA[8,8];
...
//Array "all" is filled with objects
...
List<ClassA> some = new List<ClassA>();
...
//List "some" is filled with some objects taken from all
...
List<ClassA> others = new List<ClassA>();

Now I'd like to get the difference between "all" and "some", for example something like this: other = all - some

1 Answer 1

2

Generally speaking, you can use Except:

var others = all.Except(some);

In your specific case with the two dimensional array, you first have to bring all into the right "form" using Cast:

var others = all.Cast<ClassA>().Except(some);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.