About 790,000 results
Open links in new tab
  1. c - Find array index if given value - Stack Overflow

    Jul 28, 2014 · I want to retrieve the index in the array where the value is stored. I know the value of the item at that point in the array. I'm thinking it's similar to the findIndex function in c#. For …

  2. Getting the index of a particular item in array - Stack Overflow

    Oct 7, 2020 · I want to retrieve the index of an array but I know only a part of the actual value in the array. For example, I am storing an author name in the array dynamically say "author = …

  3. c# - Find index of a value in an array - Stack Overflow

    Nov 20, 2009 · This gives you the first item for which IsKey is true (if there might be non you might want to use .FirstOrDefault() To get both the item and the index you can use. …

  4. c# - Finding the last index of an array - Stack Overflow

    Jun 29, 2009 · The array has a Length property that will give you the length of the array. Since the array indices are zero-based, the last item will be at Length - 1. string[] items = GetAllItems(); …

  5. c# - How do you get the index of the current iteration of a foreach ...

    Sep 4, 2008 · Hi Brian Gideon - definitely agree (this was a few years ago and I was far less experienced at the time). However, while Dictionary isn't indexable, an iteration of Dictionary …

  6. Find index of item in a multidimensional array - Stack Overflow

    May 8, 2025 · You might also find the Array.GetLength method and Array.Rank property useful. I recommend setting up a small multidimensional array and using all these methods and …

  7. c# - Get array item based on index - Stack Overflow

    Oct 1, 2011 · I have used code earlier to get the index of a specified item but now I want the opposite, to get the item of the specified index. I have tried a few things but can't get it …

  8. How can I find index of the array in C#? - Stack Overflow

    Mar 4, 2022 · Array.IndexOf() gives you the index of an object in an array. Just make sure you use the same data types, i.e. byte here. This is the full code, tested in .NET 4.5.2

  9. How can I find the index for a given item in a list?

    [i for i in range(len(mylist)) if mylist[i]==myterm] # Get the indices [each for each in mylist if each==myterm] # Get the items mylist.index(myterm) if myterm in mylist else None # Get the …

  10. c# - How to get index using LINQ? - Stack Overflow

    Mar 18, 2010 · myCars.TakeWhile(car => !myCondition(car)).Count(); It works! Think about it. The index of the first matching item equals the number of (not matching) item before it.

Refresh