我已经用linq查看了RegEx和SQLMatch,但我似乎无法找到适合我情况的规则.我想创造的将是......
//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/
Run Code Online (Sandbox Code Playgroud)