如何在 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;
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
JavaScript
PHP