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 8521985
In Process

The Archive Base Latest Questions

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

just got curious if this LINQ Statement: string[] digits = { zero, one, two,

  • 0

just got curious if this LINQ Statement:

  string[] digits = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" };
  var shortDigits = digits.Where((digit, index) => digit.Length < index);

is convertible to this style of LINQ:

  var shortDigits  = from d in digits
                     ..........

If yes, can you please show me how…

  • 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-11T06:58:50+00:00Added an answer on June 11, 2026 at 6:58 am

    The problem you’re having is that the overload of Where that you’re using isn’t supported in the fluent query syntax.

    You can however get around this by performing a select first and projecting the index into your results like so:

    var digitsWithIndex = digits.Select((d, i) => new { Digit = d, Index = i });
    

    You can then consume the index in the fluent query syntax:

    var query = from d in digitsWithIndex
                where d.Digit.Length < d.Index
                //just select the digit, we don't need the index any more
                select d.Digit;
    

    This yields the results “five”, “six”, “seven”, “eight”, “nine”.

    I think in this situation I’d recommend sticking with using lambda syntax though, but that’s my personal preference.

    Here’s the full code that I knocked up in LinqPad:

    var digits = new []
    {
        "zero",
        "one",
        "two",
        "three",
        "four",
        "five",
        "six",
        "seven",
        "eight",
        "nine",
    };
    
    var digitsWithIndex = digits.Select((d, i) => new { Digit = d, Index = i });
    
    var query = from d in digitsWithIndex
                where d.Digit.Length < d.Index
                //just select the digit, we don't need the index any more
                select d.Digit;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just got my copy of Expert F# 2.0 and came across this statement,
I just got this question on an interview and had no idea how to
So I'm just going to dive into this issue... I've got a heavily used
I am just curious - did anyone got Fiddler to work with Windows Phone
Possible Duplicate: curly braces in string Just came across this piece of code and
Sorry for this newbie question, just got starting. I want a simple program to
I just got another assignment for web design. And I was curios how to
Just got the new iPad, and when I touch the microphone and say a
i just got a call from Hosting company, they claimed that my application creates
I just got an email from twitter saying my keys have now been enabled

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.