Click here to Skip to main content
15,914,444 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Difficult to sort Pin
Mike Hankey11-Feb-15 23:09
mveMike Hankey11-Feb-15 23:09 
GeneralRe: Difficult to sort Pin
_Maxxx_12-Feb-15 0:51
professional_Maxxx_12-Feb-15 0:51 
GeneralRe: Difficult to sort Pin
Mark_Wallace11-Feb-15 23:16
Mark_Wallace11-Feb-15 23:16 
GeneralRe: Difficult to sort Pin
Johnny J.11-Feb-15 23:20
professionalJohnny J.11-Feb-15 23:20 
GeneralRe: Difficult to sort Pin
FIorian Schneidereit12-Feb-15 0:29
FIorian Schneidereit12-Feb-15 0:29 
GeneralRe: Difficult to sort : SOLVED!! Pin
newton.saber12-Feb-15 2:08
newton.saber12-Feb-15 2:08 
GeneralRe: Difficult to sort : SOLVED!! Pin
#realJSOP12-Feb-15 2:11
professional#realJSOP12-Feb-15 2:11 
GeneralRe: Difficult to sort : SOLVED!! Pin
newton.saber12-Feb-15 2:16
newton.saber12-Feb-15 2:16 
John Simmons / outlaw programmer wrote:
Solves for the known set, but what about twelfth.txt, thirteenth.txt, etc?

That is a great question.

If the user had more of those crazy file names, he can simply add the names to the enum and it will work.

You may say to that, "well, there could be hundreds of these".
Yes, and for that we could use the Directory.GetFiles() and Path.GetFileNameWithoutExtension to gen a comma delimited list and save it to a file, then just copy the list to the enumeration and that part would be done too.

It's a bit clunky, but it does work. Smile | :)

EDIT: Oops I think I fell into a loop of thinking here. Blush | :O Actually, when you use Directory.GetFiles and got the names, they wouldn't be sorted properly to add to the enum so we are back at the beginning challenge. The sort is all based upon the enum being in order since an enum's values are then in ascending order by default.

modified 12-Feb-15 8:29am.

GeneralRe: Difficult to sort : SOLVED!! Pin
Freak3012-Feb-15 2:29
Freak3012-Feb-15 2:29 
GeneralRe: Difficult to sort : SOLVED!! Pin
newton.saber12-Feb-15 2:30
newton.saber12-Feb-15 2:30 
GeneralRe: Difficult to sort : SOLVED!! Pin
PIEBALDconsult12-Feb-15 4:00
mvePIEBALDconsult12-Feb-15 4:00 
GeneralRe: Difficult to sort : SOLVED!! Pin
Kenneth Haugland12-Feb-15 4:51
mvaKenneth Haugland12-Feb-15 4:51 
GeneralRe: Difficult to sort : SOLVED!! Pin
Amarnath S12-Feb-15 2:30
professionalAmarnath S12-Feb-15 2:30 
GeneralRe: Difficult to sort : SOLVED!! Pin
PhilLenoir12-Feb-15 2:50
professionalPhilLenoir12-Feb-15 2:50 
GeneralRe: Difficult to sort : SOLVED!! Pin
newton.saber12-Feb-15 2:54
newton.saber12-Feb-15 2:54 
GeneralRe: Difficult to sort : SOLVED!! Pin
PhilLenoir12-Feb-15 2:58
professionalPhilLenoir12-Feb-15 2:58 
GeneralRe: Difficult to sort : SOLVED!! Pin
newton.saber12-Feb-15 3:14
newton.saber12-Feb-15 3:14 
GeneralRe: Difficult to sort : SOLVED!! Pin
PhilLenoir12-Feb-15 3:15
professionalPhilLenoir12-Feb-15 3:15 
GeneralRe: Difficult to sort Pin
BillWoodruff12-Feb-15 3:42
professionalBillWoodruff12-Feb-15 3:42 
GeneralRe: Difficult to sort Pin
Amarnath S12-Feb-15 3:46
professionalAmarnath S12-Feb-15 3:46 
GeneralRe: Difficult to sort Pin
BillWoodruff12-Feb-15 4:01
professionalBillWoodruff12-Feb-15 4:01 
GeneralRe: Difficult to sort Pin
#realJSOP12-Feb-15 4:29
professional#realJSOP12-Feb-15 4:29 
GeneralRe: Difficult to sort Pin
Kenneth Haugland12-Feb-15 6:30
mvaKenneth Haugland12-Feb-15 6:30 
AnswerRe: Difficult to sort Pin
Mario Majčica12-Feb-15 4:07
professionalMario Majčica12-Feb-15 4:07 
GeneralRe: Difficult to sort Pin
#realJSOP12-Feb-15 4:22
professional#realJSOP12-Feb-15 4:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.