title: C# SWIG vector<string> to string[]
body: <p>Given C++ methods like</p>
  
  <pre><code>std::vector&lt; std::string &gt; getFoo();
  void setFoo( const std::vector&lt; std::string &gt; &amp;foo);
  </code></pre>
  
  <p>How can I get SWIG to expose it like this to C#</p>
  
  <pre><code>string[] getFoo();
  setFoo(string[] foo);
  </code></pre>
  
  <p>I realize that lots of <a href="https://stackoverflow.com/a/8752983/89218">people have asked</a> about <code>vector&lt;string&gt;</code> and SWIG, but I haven't seen anything addressing the conversion to/from <code>string[]</code>.  Everyone mentions using the SWIG templates, like this</p>
  
  <pre><code>%template(StringVector) vector&lt;string&gt;;
  </code></pre>
  
  <p>But that just creates a datatype that callers will have to know to marshal manually.  Ideally, a caller would only have to deal with <code>string[]</code> and let the SWIG layer figure it out.</p>
  
  <p>How can I simply use <code>string[]</code> in C# but have it turn into <code>vector&lt;string&gt;</code> in C++?</p>