title: How to replace text of a particular line in string in c#?
body: <p>I need to replace a text with the new text of a particular line in a multiline string. Suppose I need to replace 6th line <strong>6</strong> with <strong>Six</strong>. I am doing in this way, But I don't think that this is the optimized way, Is there any better way to do this?</p>
  
  <pre><code>string str = "1\n2\n3\n4\n5\n6\n7\n8\n9";
  string[] output = str.Split('\n');
  output[5] = output[5].Replace("6", "Six");
  str = string.Join("\n", output);
  </code></pre>