title: How to replace some particular string in a list of type string using linq?
body: <p>Hi all I have list of type string with some items. i want to replace some items using linq, how can i do that? my below code is working fine but i want to do this in single line of code using the power of linq.</p>
  
  <p>Here is my code :</p>
  
  <pre><code>List&lt;string&gt; listcolumns = columns.ToList();//Array to list
  
  if (listcolumns.Contains("HowToReplace") &amp;&amp; listcolumns.Contains("HowTo Replace"))
  {
      int index = 0;
      index = listcolumns.IndexOf("HowToReplace");
      if (index &gt; 0)
      {
          listcolumns.RemoveAt(index);
          listcolumns.Insert(index, "HowTo Replace");
      }
      index = listcolumns.IndexOf("HowToReplace");
      if (index &gt; 0)
      {
          listcolumns.RemoveAt(index);
          listcolumns.Insert(index, "HowTo Replace");
      }
      columns = listcolumns.ToArray&lt;string&gt;();//List to array
  }
  </code></pre>