如何快速归零的数组? [英] How to quickly zero out an array?
本文介绍了如何快速归零的数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前在做它在一个for循环,我知道用C就有ZeroMemory API,但是这似乎并没有在C#中可用。也不从Java有点相当于Array.fill要么存在。我只是想知道,如果有一个更简单/更快的方式?
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.fill from Java exist either. I am just wondering if there is an easier/faster way?
推荐答案
尝试阵列。清除():
设定了一系列的数组元素
至零,以假
,或
空
(在Visual Basic中为Nothing),这取决于
元素类型。
Sets a range of elements in the Array to zero, to
false
, or tonull
(Nothing in Visual Basic), depending on the element type.
这篇关于如何快速归零的数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文