how to convert this? [closed]
hi may i know how to convert this c++ code to c#?
memset(device, 0, 32);
I tried the following :
device = new string(Char(32));
Is this correct?
well, basically, in c#, you can simply say :
string device = string.Empty;
in fact, you can even say:
var device = string.Empty;
At this point, device
is initialized as a pointer to a string variable who's current value is string.Empty
or ""
, with whatever amount of memory c# decides that it needs. The amount of memory allocated to that object will be transparent to you as the .net developer.
One of the major differences between c++ and c# is that c# handles all the memory management for you behind the scenes.
精彩评论