如何快速归零的数组?

编程入门 行业动态 更新时间:2024-10-18 16:47:57
本文介绍了如何快速归零的数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我目前在做它在一个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 to null (Nothing in Visual Basic), depending on the element type.

更多推荐

如何快速归零的数组?

本文发布于:2023-11-13 02:12:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1583129.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数组   快速

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!