Answers for "how to check if an index exist in array c#"

C#
1

c sharp check if array index exists

// int index = any index which you need to check if exists in array
if(index < array.Length)
{
    Console.WriteLine(array[index]);
}
Posted by: Guest on October-27-2021
0

check if that inex exisits array c#

var array=new List<int>(1,2,3);
int count=5;
for(int i=0;i<count;i++){
	if(array.Count>i){  //this is way you can check wheater 
      	//do something   //index count equals to array count
	}
}
Posted by: Guest on June-26-2020

Code answers related to "how to check if an index exist in array c#"

C# Answers by Framework

Browse Popular Code Answers by Language