fix undesirable `wstring` encoding at return value marshalling for C#
diff --git a/Lib/csharp/std_wstring.i b/Lib/csharp/std_wstring.i
index 09bdaaa..b18a2cc 100644
--- a/Lib/csharp/std_wstring.i
+++ b/Lib/csharp/std_wstring.i
@@ -23,7 +23,10 @@
// wstring
%typemap(ctype, out="void *") wstring "wchar_t *"
-%typemap(imtype, inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]") wstring "string"
+%typemap(imtype,
+ inattributes="[global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]",
+ outattributes="[return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]"
+ ) wstring "string"
%typemap(cstype) wstring "string"
%typemap(csdirectorin) wstring "$iminput"
%typemap(csdirectorout) wstring "$cscall"
diff --git a/Lib/csharp/wchar.i b/Lib/csharp/wchar.i
index 9361edf..79fb5a8 100644
--- a/Lib/csharp/wchar.i
+++ b/Lib/csharp/wchar.i
@@ -20,6 +20,7 @@
%pragma(csharp) imclasscode=%{
protected class SWIGWStringHelper {
+ [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]
public delegate string SWIGWStringDelegate(global::System.IntPtr message);
static SWIGWStringDelegate wstringDelegate = new SWIGWStringDelegate(CreateWString);