Function for encoding strings in-place
Your solution:


copies the whole string twice (1. string.ToCharArray() 2. new string())
needs n bytes of extra storage (apart from the input and output; n is the size of the output)
potentially moves the characters in the string a lot (O(n2))
requires the input to already have free space for the expansion


Solution using StringBuilder:


copies the whole string twice (1. calls to Append() 2. StringBuilder.ToString())
needs about n bytes of extra storage
doesn't need to move characters at all
doesn't require the input to be in any special format


Based on this, StringBuilder is clearly the better solution.

But there is even better solution: just use string.Replace(). That's likely going to be quite efficient and it's much shorter than any other of the proposed alternatives.