Working with Array.IndexOf() | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Working with Array.IndexOf()

https://code.sololearn.com/cuy7g678n13N/?ref=app I would like to find the index of a int value in a 1d-Array. Searching on Google brought me to array.IndexOf(array, 5) ...this should return the index of the value equal to 5. But it doesn't. What's wrong with Dr.Google? :P

26th Jun 2018, 12:30 AM
Oliver
2 Answers
+ 4
It must be: Console.WriteLine(Array.IndexOf(array,5));
26th Jun 2018, 12:37 AM
John Wells
John Wells - avatar
+ 1
Thanks a lot Sir, after that short answer it seems legit. My fault. Thanks
26th Jun 2018, 12:40 AM
Oliver