I have a line of code that I don't understand what it means, and I don't really know what I have to search on google to find some information about it:
private static string[] errors = new string[6] {"1","2","3","4","5","6"};
string str = httpRequest.Get(s + "'").ToString(); // s = url
if (!(errors).Any<string>(new Func<string, bool>(str.Contains)))
return;
I know this might be a bad question or stupid question but I do want to understand what it does first before I continue with other stuff.
It's not a bad question but code style:
if (!(errors).Any<string>(new Func<string, bool>(str.Contains)))
return;
can be rewritten into readable chunk as
if (!errors.Any(item => str.Contains(item)))
return;
which means "if errors collection doesn't have (!) Any item which Contains in str then return."
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