IEnumerable - Linq query select distinct values

Ranjeet_8
Posted by Ranjeet_8 under LINQ category on | Points: 40 | Views : 3717
IEnumerable - Linq query select distinct values
#Code Behind
 
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string[] MArt = { "Artists", "Musical", "Musical Artists", "Artists", "Artists Musical", "Artists" };
IEnumerable<string> aArt =
(from art in MArt
select art).Distinct();
foreach (var artist in aArt)
{
Response.Write(artist);
Response.Write("<br/>");
}
}
}

Comments or Responses

Login to post response