Tuesday, September 16, 2014

How to check if string contains a string from a string array

Using LINQ Any
string[] rpts = { "rpt""rtp""Rpt""Report" };
using if and any to check whether string contains any item from array
if (rpts.Any(url.Contains))
{
    ........
}

No comments:

Post a Comment