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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:39:06+00:00 2026-05-12T00:39:06+00:00

By alphabetically by length I mean as follows: given: { =, ==>>, =>>, =>,

  • 0

By alphabetically by length I mean as follows:

given:
{ “=”, “==>>”, “=>>”, “=>”, “!>” }

I want to get out:

!>
=
=>
=>>
==>>

I’m currently just using OrderBy(x => x.Length).ToArray()

anyone got a better lambda?

Is this reasonably possible? lol, I’m not sure what the rule conventions here would be 🙁

  • 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-12T00:39:06+00:00Added an answer on May 12, 2026 at 12:39 am

    Writing your own string comparer you can do this, which meets both set of requirements you’ve posted.

        public class MyStringComparer : IComparer<string>
        {
            #region IComparer<string> Members
    
            public int Compare(string x, string y)
            {
                if (x[0] == y[0])
                {
                    return x.Length.CompareTo(y.Length);
                }
                else return x[0].CompareTo(y[0]);
            }
    
            #endregion
        }
    

    a bcde bcd b bced cb

    would yield:

    a b bcd bcde bced cb

    and { “=”, “==>>”, “=>>”, “=>”, “!>” }

    yields:

    !>
    =
    =>
    =>>
    ==>>
    

    by calling: myStringCollection.OrderBy(x=>x, new MyStringComparer).ToArray();

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

Sidebar

Related Questions

By default nunit tests run alphabetically. Does anyone know of any way to set
I'm looking to sort the start menu alphabetically using C#. I've read about deleting
By default (using the plain style) BibTeX orders citations alphabetically. How to order the
How can I sort an array first by length, then alphabetically? I have a
given a large list of alphabetically sorted words in a file,I need to write
I got a UITextView with an arbitrary length text (up to 10000 characters). I
I'm trying to compare 2 strings alphabetically for sorting purposes. For example I want
I have this code to echo out fields in a database alphabetically with headers
What is the best way to segregate the data alphabetically using SQL? I would
How do I sort first by line length, then alphabetically, then split by line

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.