我有一个C ++库,我在C#应用程序中使用它。 C ++库中的一个方法返回char *
。如何将char *
转换为我的C#应用程序中的字符串?
显然在我的C#应用程序中,此方法返回的数据类型是sbyte *
类型。
答案 0 :(得分:4)
String
有a constructor that takes a char*
:
char* x = ...
string s = new string(x);
another one that takes a sbyte*
:
sbyte* x = ...
string s = new string(x);