C#通过Array.Clear部分清除数组的代码

将代码过程中重要的一些代码片段记录起来,如下的代码是关于C#通过Array.Clear部分清除数组的代码,希望对大家有所用。

创新互联自2013年创立以来,是专业互联网技术服务公司,拥有项目网站设计制作、网站建设网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元乐业做网站,已为上家服务,为乐业各地企业和个人服务,联系电话:18980820575

using System;

class ArrayClear
{

public static void Main()
{
int[] integers = { 1, 2, 3, 4, 5 };
DumpArray ("Before: ", integers);
Array.Clear (integers, 1, 3);
DumpArray ("After: ", integers);
}

public static void DumpArray (string title, int[] a)
{
Console.Write (title);
for (int i = 0; i < a.Length; i++ )
{
Console.Write("[{0}]: {1, -5}", i, a[i]);
}
Console.WriteLine();
}
}

这段代码的输出结果如下:

Before: [0]: 1 [1]: 2 [2]: 3 [3]: 4 [4]: 5
After: [0]: 1 [1]: 0 [2]: 0 [3]: 0 [4]: 5

当前文章:C#通过Array.Clear部分清除数组的代码
转载注明:https://www.cdcxhl.com/article40/pgggho.html

成都网站建设公司_创新互联,为您提供域名注册建站公司App开发外贸建站微信公众号虚拟主机

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

h5响应式网站建设