Hi I have a text box that has values separated by a comma. I am trying to remove the duplicate values for, example this text box will have values like:
John, Adam, Mike, John, Mike
I want it to return unique values like:
John, Adam, Mike
I found a VB function and converted it to C# but it's giving me errors like newArray is a variable but used as a method. Thanks
public string RemoveDuplicates(string items)
{
StringBuilder Result = new StringBuilder();
Array newArray = default(Array);
newArray = Strings.Split(items, ",");
for (int i = 0; i <= newArray.Length - 1; i++)
{
if (Result.ToString.IndexOf(newArray(i).ToString()) == -1)
{
Result.Append(newArray(i).ToString() + ",");
}
}
return ...
Go to the complete details ...