message: Manual marshal of C arrays.
diff: %define MarshalType(CTYPE, CSTYPE)
  %typemap(ctype) CTYPE*,CTYPE&,CTYPE[ANY] "CTYPE*"
  %typemap(imtype) CTYPE*,CTYPE& "global::System.IntPtr"
  -%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]") CTYPE[ANY] "CSTYPE[]"
  +%typemap(imtype,
  + inattributes="[global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]",
  + out="CSTYPE*") CTYPE[ANY] "CSTYPE[]"
  %typemap(cstype) CTYPE*,CTYPE& "CSTYPE*"
  %typemap(cstype) CTYPE[ANY] "CSTYPE[]"
  %typemap(csin) CTYPE*,CTYPE& "(global::System.IntPtr)$csinput"
  }
  %}
  %typemap(csout, excode=SWIGEXCODE) CTYPE[ANY] {
  - CSTYPE[] retVal = $imcall;$excode
  + CSTYPE* arrayPtr = $imcall;$excode
  + CSTYPE[] retVal = new CSTYPE[$1_dim0];
  +
  + for(int i = 0; i < $1_dim0; i++) {
  + retVal[i] = arrayPtr[i];
  + }
  +
  return retVal;
  }
  %typemap(csvarout, excode=SWIGEXCODE2) CTYPE[ANY] %{
  get {
  - CSTYPE[] retVal = $imcall;$excode
  + CSTYPE* arrayPtr = $imcall;$excode
  + CSTYPE[] retVal = new CSTYPE[$1_dim0];
  +
  + for(int i = 0; i < $1_dim0; i++) {
  + retVal[i] = arrayPtr[i];
  + }
  +
  return retVal;
  }
  %}
  