您的位置:首页 > 编程语言 > C语言/C++

C#学习笔记 对比C++

2016-07-25 16:11 489 查看
1,C#调用C++的dll中带指针的函数时,使用ref来进行操作

C++

cplusplus.dll

.......
int AddFun(int * a,int *b);


C#

[DllImport("cplusplus.dll")]
public static extern int Add(ref int a,ref int b);


unsofe代码块中可以进行指针操作

2,C++中的typedef,C#没有找到合适的替换方法

C#中可以使用using进行取别名的操作

C++

typedef  int  MYINT;//1
typedef  const int  MYCINT;//2
typedef  struct StrTest
{
int test0;
int test1;
}MyTest //3
.......


C#

using MYINT= System.Int32;//1
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: