C# - Program to add an extra ' where a ' is found
I am working on something which adds a single quote ' for every ' found in the string. 

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    namespace ConsoleApplication1
    {
      class Program
      {
        static void Main(string[] args)
        {
            string insertStatement = "INSERT INTO EXCEPTION_LOG (value1, value2" +
                                        "VALUES ('test', 'test2');";

            AddEscapeStrings(insertStatement);
            Console.Read();
        }

        private static void AddEscapeStrings(string insertStatement)
        {
            int i = 0;
            char[] c = insertStatement.ToCharArray();
            
            while (i < c.Length)
            {
                if (c.ElementAt(i) == '\'')
                {
                    Console.Write(i + ", ");
                    c[i - 1] = '\'';
                }

                i++;

                Console.WriteLine("\r\n ");

                for (int j = 0; j < c.Length; j++ )
                {
                    Console.Write(c.GetValue(j));
                }
            }            
        }
      } 
    }

That piece of code is finding all the positions of the ', now I want to add an extra ' before it. However I am not sure which is the best way to do it, does c# have a method which adds a ' in the position required without replacing the current character at that position, or do I have to shift the array each time?

The desired result would be (note the double single quotes): 

"INSERT INTO EXCEPTION_LOG (value1, value2" +
"VALUES (''test'', ''test2'');";

C# - Program to add an extra ' where a ' is found
===

I am working on something which adds a single quote ' for every ' found in the string. 

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    namespace ConsoleApplication1
    {
      class Program
      {
        static void Main(string[] args)
        {
            string insertStatement = "INSERT INTO EXCEPTION_LOG (value1, value2" +
                                        "VALUES ('test', 'test2');";

            AddEscapeStrings(insertStatement);
            Console.Read();
        }

        private static void AddEscapeStrings(string insertStatement)
        {
            int i = 0;
            char[] c = insertStatement.ToCharArray();
            
            while (i < c.Length)
            {
                if (c.ElementAt(i) == '\'')
                {
                    Console.Write(i + ", ");
                    c[i - 1] = '\'';
                }

                i++;

                Console.WriteLine("\r\n ");

                for (int j = 0; j < c.Length; j++ )
                {
                    Console.Write(c.GetValue(j));
                }
            }            
        }
      } 
    }

That piece of code is finding all the positions of the ', now I want to add an extra ' before it. However I am not sure which is the best way to do it, does c# have a method which adds a ' in the position required without replacing the current character at that position, or do I have to shift the array each time?

The desired result would be (note the double single quotes): 

"INSERT INTO EXCEPTION_LOG (value1, value2" +
"VALUES (''test'', ''test2'');";
