compare two arrays return false or true

I am trying to compare two arrays :

arr1 = ["foo", "bar", "baz"] arr2 = ["cat"] Returns false

arr1 = ["foo", "bar", "baz"] arr2 = ["bar", "foo"] Returns true

arr1 = ["foo", "bar", "baz"] arr2 = ["bar", "foo", "pea"] Returns false

how can I do this using foreach using C#?

Read more here:

Content Attribution

This content was originally published by dicho at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: