-2

I define array as

var arr = new double[image.Width, image.Height];

I need select unique values from this array

how i can do it?

3

1 Answer 1

0

You can use LINQ to flatten the multi dimensional array and then do a distinct on the result:

var flattened = Enumerable.Range(0, arr.GetLength(0)).SelectMany(x => Enumerable.Range(0, arr.GetLength(1)).Select(y => arr[x, y]));

var distinct = flattened.Distinct().ToList();
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.