如何找到 C# 中数组的长度?
要查找数组的长度,请使用 Array.Length() 方法。
示例
让我们看一个示例 -
using System;
class Program {
static void Main(){
int[] arr = new int[10];
// finding length
int arrLength = arr.Length;
Console.WriteLine("Length of the array: "+arrLength);
}
}输出
Length of the array: 10
上面我们有一个数组 -
int[] arr = new int[10];
现在,要查找长度,我们使用了 Length() 方法 -
int arrLength = arr.Length;
广告
数据结构
网络
关系型数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP