When i execuse these lines
drpdf["meno"] = matches.Cast<Match>().Where(c => c.Groups["ID"].Value == i.ToString()).Select(c => c.Groups["meno"].Value);
drpdf["info"] = matches.Cast<Match>().Where(c => c.Groups["ID"].Value == i.ToString()).Select(c => Regex.Replace(c.Groups["zvysok"].Value, @"^,\s?", string.Empty));
it wont save into DataRow value that i want, instead of
System.Linq.Enumerable+WhereSelectEnumerableIterator`2[System.Text.RegularExpressions.Match,System.String]
Can you help me pls how to select/cast return value to the readable type? Thanks anyway. Ondro
Your LINQ queries use
Select, so you get anIEnumerable<T>back. If you want the result of your LINQ query, and are expecting exactly one result, add.Single():On the other hand, if your query can have multiple results, you should use
.First()instead to take the first result. At that point, however, it depends what your scenario is and what you’re trying to capture.