title: Constructor initializing C# string array with another string array
body: <p>Deep and shallow constructor work like below. </p>
  
  <pre><code>using System;
  
  
  namespace StringArrayInitializationTest
  {
      class Program
      {
          static void Main(string[] args)
          {
              string[] lsa = { "one", "two", "three" };
  
              // Shallow copy
              MyClass myObj = new MyClass(lsa);
              myObj.EditFirst();
              Console.WriteLine("First array item in local : " + lsa[0]);
              myObj.CheckFirst();
              // Deep copy
              MyCopyClass mycpyObj = new MyCopyClass(lsa);
              mycpyObj.EditFirst();
              Console.WriteLine("First array item in local : " + lsa[0]);
              mycpyObj.CheckFirst();
          }
      }
  
      class MyClass
      {
          private string[] sa = null;
          public MyClass(string[] psa)
          {
              sa = psa;
          }
          public void CheckFirst()
          {
              Console.WriteLine("First array item in object : " + sa[0]);
          }
          public void EditFirst()
          {
              sa[0] = "zero";
          }
      }
      class MyCopyClass
      {
          private string[] sa = null;
          public MyCopyClass(string[] psa)
          {
              sa = new string[psa.Length];
              for(int i=0; i&lt;psa.Length; i++)
              {
                  sa[i] = psa[i];
              }
          }
          public void CheckFirst()
          {
              Console.WriteLine("First array item in object : " + sa[0]);
          }
          public void EditFirst()
          {
              sa[0] = "one";
          }
      }
  }
  </code></pre>
  
  <p>But the question here is can I get deep constructor with shortcut. 
  Some thing look like below which is not syntactically correct.</p>
  
  <pre><code>        public MyClass(string[] psa)
          {
              sa = new string[](psa); // Syntax error here
          }
  </code></pre>
  
  <p>What is the second way to initialize string array in deep copy behavior (with small code like above)? </p>