I want to split the given string and remove the duplicate from that string. Like I have following string:
This is my first post in stack overflow, I am very new in development and I did not have much more idea about the how to post the question.
Now I want to split that whole string with white space and that new array will did not have duplicate entry.
How can I do this?
Distinct()andWhere()are LINQ extension methods, so you must haveusing System.Linq;in your source file.The above code will return an instance of
IEnumerable<string>. You should be able to perform most operations required using this. If you really need an array, you can append.ToArray()to the statement.