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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:36:53+00:00 2026-05-15T11:36:53+00:00

To take it down to brass tacks, I have a List containing 100 various

  • 0

To take it down to brass tacks, I have a List containing 100 various records. A Car has a Year, Make and Model.

I need to be able to :

  1. order this according to Year, but I need to:

  2. have all Cars that are Ford
    Explorers appear as a “group” at the
    end of my List (also ordered
    according to Year)

I’m not sure if I’ll have to create 2 separate List and then merge them… seems like there should be a better way to do this than having to create multiple objects.

Your help is appreciated and welcomed!

Many Thanks,
paul

Example:

2001 Hummer H1
2002 Ford Focus
2008 BMW 325i
2008 Ford Escape
2009 BMW 328i
2009 Mitsubishi Galant
2003 Ford Explorer
2004 Ford Explorer
2008 Ford Explorer
2009 Ford Explorer

  • 1 1 Answer
  • 1 View
  • 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-15T11:36:54+00:00Added an answer on May 15, 2026 at 11:36 am

    If you truly only want the Ford Explorers to be grouped, you can do the following:

    var groupedByFordExplorer = from c in cars
                        let isFordExplorer = c.Make == "Ford" && c.Model == "Explorer"
                        orderby isFordExplorer, c.Year
                        select c;
    

    What the above query does is create an inline value , isFordExplorer, and assigns it a boolean value using the let keyword indicating whether the car is a Ford Explorer. That value can then be sorted by, along with the Year. The following is a working program that should demonstrate the concept:

    class Program
    {
        static void Main(string[] args)
        {
            var cars = new List<Car>
            {
                new Car { Year = 2009, Make = "Ford", Model = "Explorer" },
                new Car { Year = 2001, Make = "Hummer", Model = "H1" },             
                new Car { Year = 2002, Make = "Ford", Model = "Focus" },
                new Car { Year = 2008, Make = "BMW", Model = "325i" },
                new Car { Year = 2008, Make = "Ford", Model = "Explorer" },             
                new Car { Year = 2008, Make = "Ford", Model = "Escape" },               
                new Car { Year = 2009, Make = "Mitsubishi", Model = "Galant" },
                new Car { Year = 2004, Make = "Ford", Model = "Explorer" },
                new Car { Year = 2009, Make = "BMW", Model = "329i" },
                new Car { Year = 2003, Make = "Ford", Model = "Explorer" }              
            };
    
            var groupedByFordExplorer = from c in cars
                                        let isFordExplorer = c.Make == "Ford" && c.Model == "Explorer"
                                        orderby isFordExplorer, c.Year
                                        select c;
    
            foreach (var car in groupedByFordExplorer)
            {
                Console.WriteLine("{0} {1} {2}", car.Year, car.Make, car.Model);
            }
    
            Console.ReadLine();
        }
    }
    
    class Car
    {
        public int Year { get; set; }
        public string Make { get; set; }
        public string Model { get; set; }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been contacted by a hacker saying there gonna take my site down
Need to take a SELECT drop down list options and find if any of
I have been asked to take down a website, and as such have removed
I want to take my website down for an hour while I make changes
I would like to design very high availability(never take server down, roll out features
Take the following snippet: List<int> distances = new List<int>(); Was the redundancy intended by
I wonder if you could help me. I have a list of data that
Yesterday Oracle decided to take down java.sun.com for a while. This screwed things up
Rails 3 on Apache with Passenger: I need to take down Rails so that
I have a website built on top of codeigniter and I want to take

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.