string[] arr1 = new string[] { "one", "two", "three" };
string[] arr2 = new string[] { "two", "three" };
I have to know if arr1 contains all string of arr2.
How to do it by coding faster?If there is a way by using lambda?
Thank you.
string[] arr1 = new string[] { "one", "two", "three" };
string[] arr2 = new string[] { "two", "three" };
I have to know if arr1 contains all string of arr2.
How to do it by coding faster?If there is a way by using lambda?
Thank you.
You can use Linq.
arr2.All(x => arr1.Contains(x));
You can use linq to solve your problem:
Here we check that if there is any element present in the child list(i.e
arr2) which is not contained by the parent list(i.earr1).If none such exists then the list is subse of the other
eg:
bool isSubset = !(arr2.Any(x => !arr1.Contains(x)));