You can post your problem related to Microsoft Visual Studio Projects here. We will try our best to help you out.
2 posts • Page 1 of 1
Array.IndexOf gives you the index of any element present in your array. Let's write a small code here:
Now when you run it, it will give you 5 as an answer because 5 is the index of value 9. Its giving you -1 because the value whose index you are trying to check is not present in your array.
Code: Select all
int array = new int; array = 1; array = 3; array = 5; array = 7; array = 8; array = 9; int index1 = Array.IndexOf(array, 9);