I habe a sentence:
string x = "This is a first string, this is a second string.";
When add every word into an array
string[] words = x.Trim().Split(new char[] { ' ' });
What do I have to do to add only unique words into the array ?
Use Linq.
Also, since Split takes a params array, you don't need the new char[] part.
string[] words = x.Trim().Split(' ').Distinct().ToArray();