Hello I have a table Artists and in that table there's the value BandID and I want to obtain BandIDs from the Artist list who occur twice in the Artist table. What's the correct LINQ query for this?
public class Artiest
{
public int ArtiestID { get; set; }
public string Naam { get; set; }
public int InstrumentID { get; set; }
public Instrument Instrument { get; set; }
public int PopgroepID { get; set; }
public Popgroep Popgroep { get; set; }
}
I have tried to convert this to LINQ but I'm not able to translate it.
var q =
from g in arr.GroupBy(x => x)
where g.Count() == 1
select g.First();