I'm trying to remove duplicate id's from a list on a browser I'm working on. The list is converted to array and then added to a richtextbox. This is needed for the generic bookmarking system I am working on. The issue is it scrapes duplicates. Even after I add distinct to the code.
string html = WebsCon2.ExecuteJavascriptWithResult("document.getElementsByTagName('html')[0].innerHTML");
var htmlDoc = new HtmlAgilityPack.HtmlDocument();
htmlDoc.LoadHtml(html); var playerIds = new List<string>();
var playerNodes = htmlDoc.DocumentNode.SelectNodes("//a[contains(@href, '/link/profile-view.jsp?user=')]").Distinct();
foreach (var playerNode in playerNodes)
{
string href = playerNode.Attributes["href"].Value;
var parts = href.Split(new char[] { '=' }, StringSplitOptions.RemoveEmptyEntries);
if (parts.Length > 1)
{
playerIds.Add(parts[1]);
}
string Target = string.Join("", playerIds.ToArray());
PlayerID.Text = Target;
}
So is there another way I can remove the duplicates?