here is my code:
class Program { static void Main(string[] args) { string sentence = string.Empty; sentence = Con
You could use Linq's Distinct extension method:
var sent = sentence.Split(' ').Distinct();
You can also use this to ignore the case of strings when comparing them—e.g. "WORD" and "word" would be considered duplicates:
"WORD"
"word"
var sent = sentence.Split(' ').Distinct(StringComparer.CurrentCultureIgnoreCase);