Sort question...

Posted on 2010-01-10
Medium Priority
Last Modified: 2013-12-17
I have a series of int objects (see code below).  They are used as enum's, but because they are not constant (the value can change), they are int's.  I need to sort them into numerical sequence, so I can use the object name as an enum.  (Probably not the best way to do it, but it works).

What's the best way of doing this?
//  default tab order
        int cPricingResults = 0;
        int cExport = 1;
        int cUpload = 2;
        int cAccounting = 3;
        int cRepricing = 4;
        int cASIN = 5;
        int cProgramOptions = 6;
        int cCustomerInfo = 7;
        int cInvoice = 8;
        int cBookDetail = 9;
        int cSearch = 10;
        int cTabMapping = 11;
        int cImport = 12;
        int cWebPages = 13;
        int cMassChanges = 14;
        int cCatalogs = 15;
        int cCannedText = 16;
        int cUIDPswd = 17;
        int cReports = 18;
        int cStatus = 19;

Open in new window

Question by:rmmarsh
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 86

Accepted Solution

Mike Tomlinson earned 2000 total points
ID: 26278510
You could use a SortedList:

Or just a custom class with the string name and int value added to a generic List and provide your own comparer to sort them....

Author Closing Comment

ID: 31675208
Thank you... just what I was looking for...

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

764 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