<p>I have the following intentionally trivial function:</p>

<pre><code>void ReplaceSome(ref string text)
{
    StringBuilder sb = new StringBuilder(text);
    sb[5] = 'a';
    text = sb.ToString();
}
</code></pre>

<p>It appears to be inefficient to convert this to a StringBuilder to index into and replace some of the characters only to copy it back to the ref'd param. Is it possible to index directly into the text param as an L-Value?</p>

<p>Or how else can I improve this?</p>

I don't know if this is more efficient, but it works. Either way you'll have to recreate the string after each change since they're immutable.
```
```
string test = "hello world";
    Console.WriteLine(test);

    test = test.Remove(5, 1);
    test = test.Insert(5, "z");

    Console.WriteLine(test);
```
```
Or if you want it more concise:
```
```
string test = "hello world".Remove(5, 1).Insert(5, "z");
```
```