I have the following code:
MatchCollection matches = myRegEx.Matches(content);
bool result = (from Match m in matches
where m.Groups["name"].Value.Length > 128
select m).Any();
Is there a way to do this using the Linq extension method syntax? Something like this..
bool result = matches.Any(x => ... );
解决方案
using System.Linq;
matches.Cast().Any(x => x.Groups["name"].Value.Length > 128)
You just need to convert it from an IEnumerable to an IEnumerable (IEnumerable) to get access to the linq extension provided on IEnumerable.