Multistrings (double null-terminated string of null-separated strings) are common in the Windows API. What's a good method for converting a multistring returned from an API to a C# string collection and vice versa?
I'm especially interested in proper handling of character encoding (Windows XP an later).
The following method seems to be okay for creating a multistring, but I don't have an example of decoding a multistring.
static string StringArrayToMultiString(
ICollection<string> stringArray
)
{
StringBuilder multiString = new StringBuilder();
if (stringArray != null)
{
foreach (string s in stringArray)
{
multiString.Append(s);
multiString.Append('\0');
}
}
return multiString.ToString();
}