I am learning LINQ, and I am not sure how to write a query to return a boolean indicating whether an item is found in an array. I have a very simple list:
var targetProperties = new string[] { "SelectedDate", "SelectedMonth" };
I need to write a LINQ query that will return true if an item passed in is in the array, and false if it isn't. What would that query look like?
bool answer = targetProperties.Any(x => x == "SelectedDate");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With