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

  • SEARCH
  • Home
  • 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

string strLine;//not constant int index = 0; while(index < strLine.length()){//strLine is not modified}; how
I'm trying to find an alternative to List<Tuple<Grid, TabItem, int, string, int>>... , since
I am looking for a string grid that allows me select multiple cells anywhere
Does anyone know of an existing browser/OS useragent string grid? It's hard to test,
string[] filesOfType1 = GetFileList1(); string[] filesOfType2 = GetFileList2(); var cookieMap = new Dictionary<string, CookieContainer>();
string x; foreach(var item in collection) { x += item+,; } can I write
I'd like to hava a Dojo dojox.grid.DataGrid with its data from a servlet. Problem:
@{ var grid = new WebGrid(Model.Auctions, rowsPerPage: Model.PagingInfo.ItemsPerPage, defaultSort: AddedDate); } @grid.GetHtml( columns: grid.Columns(
In my grid view there is column which contain with string data type. Some
how to assign a cell value to a grid view control cell from a

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.