xml – XElement.Descendants()使其不区分大小写

前端之家收集整理的这篇文章主要介绍了xml – XElement.Descendants()使其不区分大小写前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
XElement.Descendants()方法接受要查找的元素的名称.

但是区分大小写是否有任何方法可以使它不区分大小写

解决方法

你可以用这个:

element.Descendants()
       .Where(x => string.Compare(x.Name,filter,StringComparison.OrdinalIgnoreCase) == 0);

猜你在找的XML相关文章