String.Replace() will not change the source string of the variable : <p>I have the following code inside my c# application:-</p>

<pre><code> string[] excludechar = { "|", "\\", "\"", "'", "/", "[", " ]", ":", "&lt;", " &gt;", "+", "=", ",", ";", "?", "*", " @" };
 var currentgroupname = curItemSiteName;
 for (int i = 0; i &lt; excludechar.Length; i++)
       {
         if (currentgroupname.Contains(excludechar[i]))
             currentgroupname.Replace(excludechar[i], "");       
       }
 site.RootWeb.SiteGroups.Add(currentgroupname)
</code></pre>

<p>now in my abive code the <code>currentgroupname</code> variable which i am passing inside the <code>.ADD</code> function will have all the special characters i have replaced inside my for loop. so can anyone adivce if i can modify my code so the .Replace will be actually replacing the original string of the <code>currentgroupname</code> ...</p>
