At least one object must implement IComparable. - Sorting a GroupedCollection with Linq

I have the following structures as example:

class ServicesGroup : IServicesGroup, IComparable
{
      public string CityName { get; set; }
      public ObservableCollection<Service> Services { get; set; }
      public int CompareTo(object obj)
    {
        ServicesGroup sg = (ServicesGroup)obj;

        return String.Compare(this.CityName, sg.CityName);
    }            
}

I am trying to sort my collection of Services at each group by its [ServiceId] (ascending and descending):

tempCollection = new ObservableCollection<object>(collection.OrderBy(x => ((ServicesGroup)x).Services.OrderBy(y => y.ServiceId)));

My Service class implements IComparable as well:

I tried both
public class Service : IComparable, IEquatable
public class Service : IComparable<Service>, IEquatable<Service>

Example of my Service class:

public class Service : IComparable, IEquatable
{
            public string ServiceId {get; set;}
       

        public string ServiceType {get; set;}
           
            public int CompareTo(object obj)
        {
            Service s = (Service)obj;

            return String.Compare(this.ServiceId, s.ServiceId);
        }
       
            public bool Equals(Service other)
        {
            if (this.ServiceId.Equals(other.ServiceId) && this.ServiceType.Equals(other.ServiceType)) return true;
            return false;
        }            
}

When I try to run my linq I get the following error:

Additional information: At least one object must implement IComparable.

I can not access the [public ObservableCollection<Service> Services] for some reason. What am I missing here?
Alejandro AcevedoSr. [.NET] Developer/Systems Analyst/ConsultantAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jacques Bourgeois (James Burger)PresidentCommented:
You are defining your collection as a collection of Object

     tempCollection = new ObservableCollection<object>

The Object does not implements IComparable, thus your error. And you should never use Object when you work with a known specific type. Try

     tempCollection = new ObservableCollection<ServicesGroup >

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Alejandro AcevedoSr. [.NET] Developer/Systems Analyst/ConsultantAuthor Commented:
Thank you so much for your help James
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.