开发者

how to convert this? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit th开发者_JAVA百科e help center. Closed 11 years ago.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜