如何找到 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