Distinct returns the input sequence, stripped of duplicates.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
class Program
{
static void Main()
{
char[] distinctLetters = "HelloWorld".Distinct().ToArray();
string s = new string(distinctLetters);
Console.WriteLine(s);
}
}
The output:
HeloWrd