Handling empty values with FirstOrDefault

Hi,

How about the following expression?

dt.AsEnumerable().GroupBy(Function(r) r("number").ToString.Trim.Contains(row("id").ToString.Trim)).Select(Function(g) if(g.Key=True,g.First().Item("id").ToString,"")).OrderByDescending(Function(s) s).First()

Regards,

1 Like