Can Linq be used to find if value matches part of a larger string?

Viewed 166

I have looked into RegEx & SQLMatch with linq but I cant seem to find an applicable rule for my situation. What I am trying to create would be..

//dataCollected[0] = { Name="joe", Url="http://my.home.site/" }
//dataCollected[N] = { Name="example", Url="http://german.home.site/" }

public bool hasParent(string test_url){
    var obj = dataCollected.Where(s => ( test_url.contains(s.Url)));
    return obj.Count() > 0;
}

bool  result  = hasParent("http://my.home.site/ShouldBeTrue"); //Finds http://my.home.site/
1 Answers
Related