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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:13:11+00:00 2026-06-03T13:13:11+00:00

I have the following: var data = _cityRepository.GetAll( u => u.PartitionKey == pk &

  • 0

I have the following:

var data = _cityRepository.GetAll(
    u => u.PartitionKey == pk & 
    u.RowKey.CompareTo(lowerBound) >= 0 & 
    u.RowKey.CompareTo(upperBound) < 0);

details =
    from d in data
    select new City.Grid
    {
        PartitionKey = d.PartitionKey,
        RowKey = d.RowKey,
        ShortTitle = d.ShortTitle,
        Created = d.Created,
        Modified = d.Modified,
        ModifiedBy = d.ModifiedBy
    };

detailsList = details
    .OrderBy(item => item.Modified)
    .Select((t, index) => new City.Grid()
    {
        PartitionKey = t.PartitionKey,
        RowKey = t.RowKey,
        Row = index + 1,
        ShortTitle = t.ShortTitle,
        Created = t.Created,
        Modified = t.Modified,
        ModifiedBy = t.ModifiedBy
    })
    .ToList();

The problem for me is that I am not sure how to combine the second as it uses this:

Select((t, index) => new City.Grid()

Is there a way I could combine these statements into one or if that’s not possible could I just combine the last two?

  • 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-03T13:13:14+00:00Added an answer on June 3, 2026 at 1:13 pm

    Sure – it’s ugly, but this has all three:

    var query = _cityRepository.GetAll(
                                   u => u.PartitionKey == pk & 
                                   u.RowKey.CompareTo(lowerBound) >= 0 & 
                                   u.RowKey.CompareTo(upperBound) < 0)
                    .Select(d => new City.Grid
                            {
                                PartitionKey = d.PartitionKey,
                                RowKey = d.RowKey,
                                ShortTitle = d.ShortTitle,
                                Created = d.Created,
                                Modified = d.Modified,
                                ModifiedBy = d.ModifiedBy                          
                            }
                    .OrderBy(item => item.Modified)
                    .Select((t, index) => new City.Grid()
                    {
                        PartitionKey = t.PartitionKey,
                        RowKey = t.RowKey,
                        Row = index + 1,
                        ShortTitle = t.ShortTitle,
                        Created = t.Created,
                        Modified = t.Modified,
                        ModifiedBy = t.ModifiedBy
                    })
                    .ToList();
    

    It would be more sensible to avoid creating new City.Grid objects twice:

    var query = _cityRepository.GetAll(
                                   u => u.PartitionKey == pk & 
                                   u.RowKey.CompareTo(lowerBound) >= 0 & 
                                   u.RowKey.CompareTo(upperBound) < 0)
                    .OrderBy(item => item.Modified)
                    .Select((t, index) => new City.Grid()
                    {
                        PartitionKey = t.PartitionKey,
                        RowKey = t.RowKey,
                        Row = index + 1,
                        ShortTitle = t.ShortTitle,
                        Created = t.Created,
                        Modified = t.Modified,
                        ModifiedBy = t.ModifiedBy
                    })
                    .ToList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following code var res = from c in model.Data select new object[]
I have the following linq expression pulling all data from my database: var items
I have the following query: var data = from d in dc.GAMEs where (d.GAMEDATE
I have the following LINQ query - var data = (from req in db.tblRequirements
I have data like the following: var data = [{ id: 1, date: new
I have the following: somefile.php $(document).ready(function() { var handler = function(data) { var JsDiv
when handling data, i always have to write the following: var dataSourceRequest:URLRequest = new
I have the following data test<-data.frame(group=1:10, var.a=rnorm(n=10,mean=500,sd=20), var.b=runif(10)) I would like a barplot with
I have the following (simplified) code: var Foo = (function () { var data
I have the following: var viewID = $(link).data('dialog-id') This works when there is 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.