Try this
string ReturnStr = "2,5,12,35,2,12,78,45,35,78";
string[] words = ReturnStr.Split(',');
List<string> list = new List<string>();
foreach (string word in words)
{
if ( ! list.Contains(word))
list.Add(word);
}
Updated
try this also
if (ReturnStr .substring(ReturnStr .length-1, ReturnStr .length) == ",") {
ReturnStr = ReturnStr .substring(0, ReturnStr .length-1);
}
TextBox1.Text = ReturnStr ;