• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 299
  • Last Modified:

Simple way to sort a collection class

I have a collection of countries, called CountryCollection, defined thus:

public class CountryCollection : KeyedCollection<string, Country>

A country has a CountryName and CountryCode, among other things.

What is the best/easiest way to sort the collection by CountryName in C# ?
0
purplesoup
Asked:
purplesoup
2 Solutions
 
xav056Commented:
Use a cortedDictionary collection
http://msdn.microsoft.com/en-us/library/f7fta44c.aspx
0
 
Eduardo GoicovichIT ConsultantCommented:
basically involves sorting the underlying List of the collection

example here

http://social.msdn.microsoft.com/forums/en-US/netfxbcl/thread/56adc0f9-aa1b-4acf-8546-082bb01058f2/
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now