I\'m having a strange problem with a linq query. I\'m using LINQPad 4 to make some a query that uses regular expression using LinqToSQL as the LinqPad driver.
Here\'
var result = from eachError in SystemErrors
let match = Regex.Match(eachError.Description, "...")
group eachError by new
{
FamilyCode = match.Groups["FamilyCode"].Value,
ProductPrefix = match.Groups["ProductPrefix"].Value,
BillingGroup = match.Groups["BillingGroup"].Value,
Debtor = match.Groups["Debtor"].Value
}
into unique
select unique.key;
When you use Distinct()
, it's distinct by pointer to each object, not value because select new {}
is object type not value type. Try using group by instead.