In .NET Core and .NET Framework 4.x the following code works as expected:
var match = Regex.Match(src, pattern)
.Groups
.Cast<Group>()
.Where(grp => grp.Name.StartsWith("val"));
However, in netstandard, the Name
property in Group
is gone. I'm wondering if there is a new way of achieving the same thing, or if this is a bug.
Edit: I first thought this was a netstandard 2.0 issue, but it looks like the property is missing from all netstandard versions.
Workaround for now:
.Where(grp => ((string)((dynamic)grp).Name).StartsWith("val"))
, which is obviously less than ideal.