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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:56:03+00:00 2026-06-17T23:56:03+00:00

I have a class like one in which student sit. i have location like

  • 0

I have a class like one in which student sit.
i have location like B6 B7 B8 B9 B10 B11
I get it in this order if i use FindAll with in some class(one oops version)
everything goes fine untill i do

    someclass.OrderBy(r => r.location);

and after that location becomes B10 B11 B6 B7 B8 B9
what is going wrong here. I am better without using orderBY then but can any one tell me reason for problem I am having ?

  • 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-17T23:56:04+00:00Added an answer on June 17, 2026 at 11:56 pm

    You could implement your own custom comparer …

    class CustomCompare : IComparer<string>
    {
        private static readonly char[] _digits = "0123456789".ToArray();
    
        public int Compare(string a, string b)
        {
            //assuming alpha start, numeric end
            var alphaA = a.TrimEnd(_digits);
            var alphaB = b.TrimEnd(_digits);
            var alphaCompareTo = alphaA.CompareTo(alphaB);
    
            if (alphaCompareTo != 0)
            {
                return alphaCompareTo;
            }
    
            var numericA = int.Parse(a.Substring(alphaA.Length));
            var numericB = int.Parse(b.Substring(alphaB.Length));
    
            return numericA.CompareTo(numericB);
        }
    }
    

    … and use it like so …

    someclass.OrderBy(r => r.location, new CustomCompare());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class that contains a boolean field like this one: public class
I have a simple model like this one: class Artist(models.Model): surname = models.CharField(max_length=200) name
Let's suppose I have xml like this one: <Server Active=No> <Url>http://some.url</Url> </Server> C# class
hii every one i have created a data entry screen like this in which
Pretend you have a class like this one: public class CreateUserRequest { ... @NotNull
I have a SDK (GigE C++), which defines a class like this: class PV_BUFFER_API
I have a model called Contact which has_one guest like so. class Contact <
I have a class like the one below: class Foo { private: std::map<std::string, Bar*>
Say I have a class with three constructors, like the one below: public class
I have a model like the following one: public class TestModel{ public IList<Field> Fields

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.