title: C# How can I do a string replace method on the collection?
body: <p>I have the following method which return a collection so I can then build a dropdown menu from in MVC. The problem is, I want to replace a substring within the values in the collection but I am not sure how to do so in C# (I'm a classic vb guy).</p>
  
  <pre><code>public class RolesManagement
  {
      public static IEnumerable&lt;string&gt; BuildRoles(string DesiredRole)
      {
          var UserRoles = Roles.GetAllRoles();
  
          IEnumerable&lt;string&gt; roles;
          roles = UserRoles.Where(x =&gt; x.Contains("Sub")).Except(rejectAdmin);
          return roles;
      }
  
  }
  </code></pre>
  
  <p>The above has been simplified for brevity. Each role in the roles collection looks like this:
  SubUser
  SubAdmin
  SubManager.</p>
  
  <p>I simply want to return
  User
  Admin
  Manager</p>
  
  <p>What would be the best approach for this in C# please?</p>
  
  <p>My guess is that I have to do a foreach and replace the substring on each loop and the re-populate the value before moving to the next item.</p>
  
  <p>If you could provide a code sample that would be great as I seem to still me tripping over syntax issues.</p>
  
  <p>Much appreciated!</p>