Somehow I can\'t seem to get string replacement within a foreach loop in C# to work. My code is as follows :
foreach (string s in names) { s.Replace(\"pdf\"
s.Replace is a function so you would like s=s.Replace().. although it's better to use StringBuilder. (see upper answer)