ASP.NET - avoid duplicates from string - Asked By msakt on 03-Aug-12 01:18 AM

s="1,2,3,4,1,2,3,5,6,7,8;

i want s ="1,2,3,4,5,6,7,8;
Danasegarane Arunachalam replied to msakt on 03-Aug-12 04:49 AM
You can take the help of the Linq for this one

Import the LINQ Name Space

using System.Linq;

And the below code get remove the duplicates from the string

  string str="1,2,3,4,1,2,3,5,6,7,8";
        var dist=str.Distinct().ToArray();