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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:17:52+00:00 2026-05-15T13:17:52+00:00

string grid = @08 02 22 97 38 15 00 40 00 75 04

  • 0
string grid = @"08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08";
string[] res = grid.Split(' ');

var lowNums = from n in res
              where n.Length > 0
              select int.Parse(n);

I am having trouble converting the above linQ statement to a lambda WHERE equivalent.
The following works, but only returns am enumernable<string> whereas I want an enumerable<int>:

IEnumerable<string> all = res.Where(x => x.Length > 0);
  • 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-05-15T13:17:53+00:00Added an answer on May 15, 2026 at 1:17 pm

    I am having trouble converting the above LINQ statement to a lambda Where() equivalent.

    What you want to do then is carefully read section 7.16.2 of the C# specification. It will walk you step-by-step through the process.

    It says:

    A query expression with a where clause

    from x in e
    where f
    ...
    

    is translated into

    from x in ( e ) . Where ( x => f )
    ...
    

    So your query

    from n in res  
    where n.Length > 0  
    select int.Parse(n);  
    

    is translated into

    from n in (res).Where(n=>n.Length > 0)
    select int.Parse(n)
    

    That’s the first stage of the translation. Now go back to the spec again:

    A query expression of the form

    from x in e select v
    

    is translated into

    ( e ) . Select ( x => v )
    

    So your translated-once-already query

    from n in (res).Where(n=>n.Length > 0)
    select int.Parse(n)
    

    is further translated into

    ((res).Where(n=>n.Length > 0)).Select(n=>int.Parse(n))
    

    and now it is not a query expression any more, so no more syntactic translation is done.

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

Sidebar

Related Questions

This doesn't work. var result = from row in grid.Rows where (string) row.Cells[COLUMN_1].Value ==
In a string grid I turned on goEditing so that the user doesn't have
I have a grid view that bounded to an object data source that select
I am working on displaying a ExtJS Grid. I got everything correct except the
I'm writing a Function that pulls Records from a DataBase using LINQ to get
I'm using jQuery Grid 3.7.2 to load data in 'loadonce' mode, i.e. jqGrid takes
I edited my whole question, so do not wonder :) Well, I want to
I'm trying to integrate ads (admob) into my Android app. It's mostly working, except
Okay so I was just starting this rails app and generated my first model
In my attempt to enable sorting and filtering in conjunction with the MVC contrib.

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.