Searching in xml with linq
I want to searching in a xml file. this is my linq sentece.
string _sSemptom = "try";
XElement xe = from c in xdSemptom.Elements().Elements().Elements()
.Elements().Attributes("Isim")
where c.Value.Le开发者_Python百科ngth >= _sSemptom.Length &&
c.Value.Contains(_sSemptom)
select c.Parent
I can find the XElement that way, but if _sSemptom is "Try" I can't find it. How can I search using upper and lower case variations?
Thanks for your helps.
Edit: Actually, it turns out there isn't a StringComparison overload for Contains(). You can use IndexOf() instead:
c.Value.IndexOf(_sSemptom, StringComparison.OrdinalIgnoreCase) > -1
精彩评论