Find Unique Text using LINQ

Ranjeet_8
Posted by Ranjeet_8 under LINQ category on | Points: 40 | Views : 1110

var DistinctText= "Rajiv, Vivek, Rajiv, Minal, Rakesh, Vivek"
.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).Distinct();
foreach (var TextItem in DistinctText)
{
Response.Write(TextItem + "<br />");
}


The output will be :
Rajiv
Vivek
Minal
Rakesh

Comments or Responses

Login to post response