I want to replace the first occurrence in a given string.
How can I accomplish this in .NET?
This example abstracts away the substrings (but is slower), but is probably much fast than a RegEx:
var parts = contents.ToString().Split(new string[] { "needle" }, 2, StringSplitOptions.None); return parts[0] + "replacement" + parts[1];