我目前在 for 循环中执行此操作,并且我知道在 C 中有 ZeroMemory API,但是在 C# 中似乎不可用。 Java 中的某种等效的 Array.fill 也不存在。我只是想知道是否有更简单/更快的方法?
最佳答案
试试 Array.Clear() :
Sets a range of elements in the Array to zero, to
false
, or tonull
(Nothing in Visual Basic), depending on the element type.
关于c# - 如何快速将数组归零?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1407715/