how to get an arrays length in c#
int array[] array;
int index;
public void func(){
for(int i; i < array.Length;i++){
index++;
}
Console.Write(index);
}
how to get an arrays length in c#
int array[] array;
int index;
public void func(){
for(int i; i < array.Length;i++){
index++;
}
Console.Write(index);
}
C# extend array
string[] items = new string[3] { "input1", "input2", "input3" };
string[] moreItems = new string[10] { "input4", "input5" };
// array to list
List<string> itemsList = items.ToList<string>();
itemsList.Add("newItem");
// or merge an other array to the list
itemsList.AddRange(moreItems);
// list to array
string[] newArray = itemsList.ToArray();
use length to resize an array
let array = [11, 12, 13, 14, 15];
console.log(array.length); // 5
array.length = 3;
console.log(array.length); // 3
console.log(array); // [11,12,13]
array.length = 0;
console.log(array.length); // 0
console.log(array); // []
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us