I have an optional custom prefix and suffix in my application, that I want to add to each of the items in my string List. I have tried all of the following and none are working. Can someone point me in the right direction please?
List<string> myList = new List<string>{ "dog", "cat", "pig", "bird" };
string prefix = "my ";
string suffix = " sucks!";
StringBuilder sb = new StringBuilder();
sb.Append(suffix);
sb.Insert(0, prefix);
MyList = sb.ToString(); //This gives me red squigglies under sb.ToString();
I also tried:
myList = myList.Join(x => prefix + x + suffix).ToList(); //Red squigglies
and:
sortBox1.Join(prefix + sortBox1 + suffix).ToList(); //Red squigglies
Where am I going wrong here?