How to quickly zero out an array?

后端 未结 7 969
青春惊慌失措
青春惊慌失措 2020-12-08 18:30

I am currently doing it in a for loop, and I know in C there is the ZeroMemory API, however that doesn\'t seem to be available in C#. Nor does the somewhat equivalent Array.

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-08 19:07

    Try Array.Clear():

    Sets a range of elements in the Array to zero, to false, or to null (Nothing in Visual Basic), depending on the element type.

提交回复
热议问题