Reputation: 24436
I have a C# COM server which is consumed by a cpp client.
One of the C# methods returns a string.
In cpp the returned string is represented in Unicode (UTF-16), at least according to the memory view.
Upvotes: 3
Views: 477
Reputation: 27363
[return: MarshalAs(UnmanagedType.LPStr)]
before the method definition in C# if you'd like to return the string as an ANSI string instead of Unicode.Upvotes: 0
Reputation: 942358
Upvotes: 1