【发布时间】:2013-12-17 20:53:14
【问题描述】:
我已经使用 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/
【问题讨论】: