Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8798921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:11:58+00:00 2026-06-14T00:11:58+00:00

Assuming I have the following string array: string[] str = new string[] {max, min,

  • 0

Assuming I have the following string array:

string[] str = new string[] {"max", "min", "avg", "max", "avg", "min"}

Is it possbile to use LINQ to get a list of indexes that match one string?

As an example, I would like to search for the string “avg” and get a list containing

2, 4

meaning that “avg” can be found at str[2] and str[4].

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T00:11:59+00:00Added an answer on June 14, 2026 at 12:11 am

    .Select has a seldom-used overload that produces an index. You can use it like this:

    str.Select((s, i) => new {i, s})
        .Where(t => t.s == "avg")
        .Select(t => t.i)
        .ToList()
    

    The result will be a list containing 2 and 4.

    Documentation here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assuming I have the following list: IList<string> list = new List<string>(); list.Add(Mouse); list.Add(Dinner); list.Add(House);
I have the following List : List<Dictionary<int, Dictionary<string, string>>> lngList lngList.Add(new Dictionary<int,Dictionary<string,string>>().Add(1,new Dictionary<string,string>().Add(Item1Key,Item1Value))); lngList.Add(new
Assuming I have the following strings: string str1 = Hello World!; string str2 =
Assuming the message argument is a string, I have the following snippet: users.each do
assuming I have the following array: views = [ { :user_id => 1, :viewed_at
Assuming I have the following string: thestring = 1) My Favorite Pokemon Charizard *22.00
Is it reliable to use the following Java code: TreeSet<String> ts = new TreeSet<String>();
I have the following pattern of a string: METHOD URL VERSION example GET /someurl/resource.html
I have the following 2 methods... @GET @Path(/{solution}) public Response test(@PathParam(solution) String solution, @Context
Assuming I have the following two JQuery functions - The first, which works: $(#myLink_931).click(function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.