第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

關(guān)于二維數(shù)組GetLength的用法

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;


namespace ConsoleApp8

{

? ? class Program

? ? {

? ? ? ? static void Main(string[] args)

? ? ? ? {

? ? ? ? ? ? int[,] text = new int[,]{ { 1, 2, 3 }, { 1, 2, 3 } };

? ? ? ? ? ? Console.Write(text.GetLength(1));


? ? ? ? }

括號(hào)里是0輸出2

括號(hào)里為1輸出3

求解


正在回答

2 回答

對(duì)于二維數(shù)組的GetLength方法的參數(shù),為0時(shí)獲取的是二維數(shù)組內(nèi)一位數(shù)組的個(gè)數(shù),也就是行數(shù),為1時(shí)獲取的是列的個(gè)數(shù),也就是每個(gè)一維數(shù)組內(nèi)元素個(gè)數(shù),類似我這個(gè)

?int[,] text = { { 1, 2, 3, 4 }, { 1, 2, 3 ,4},{ 2,6,9,10} };

?Console.Write(text.GetLength(0));? ? 輸出3

?Console.Write(text.GetLength(1));? ? 輸出4

昨天才開(kāi)始看C#,...多包涵


3 回復(fù) 有任何疑惑可以回復(fù)我~

GetLength(0)是計(jì)算二維數(shù)組的行數(shù),GetLength(1)是計(jì)算二維數(shù)組的列數(shù)

1 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

關(guān)于二維數(shù)組GetLength的用法

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)