Solved

Simple way to sort a collection class

Posted on 2011-09-21
2
228 Views
Last Modified: 2012-05-12
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
Comment
Question by:purplesoup
2 Comments
 
LVL 9

Accepted Solution

by:
xav056 earned 250 total points
ID: 36574083
Use a cortedDictionary collection
http://msdn.microsoft.com/en-us/library/f7fta44c.aspx
0
 
LVL 5

Assisted Solution

by:Eduardo Goicovich
Eduardo Goicovich earned 250 total points
ID: 36574108
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Hangfire / asp.net sample 3 28
Hide Tab Page 3 19
C# Error - Add Failed 12 49
How to Get total minutes between two hours 4 27
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now