Click here to Skip to main content
15,892,517 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to organize this data Pin
Pete O'Hanlon29-Dec-14 8:53
mvePete O'Hanlon29-Dec-14 8:53 
GeneralRe: How to organize this data Pin
PIEBALDconsult29-Dec-14 9:07
mvePIEBALDconsult29-Dec-14 9:07 
AnswerRe: How to organize this data Pin
BillWoodruff29-Dec-14 9:20
professionalBillWoodruff29-Dec-14 9:20 
GeneralRe: How to organize this data Pin
PIEBALDconsult29-Dec-14 10:04
mvePIEBALDconsult29-Dec-14 10:04 
GeneralRe: How to organize this data Pin
BillWoodruff29-Dec-14 12:12
professionalBillWoodruff29-Dec-14 12:12 
GeneralRe: How to organize this data Pin
SledgeHammer0129-Dec-14 10:50
SledgeHammer0129-Dec-14 10:50 
GeneralRe: How to organize this data Pin
BillWoodruff29-Dec-14 12:11
professionalBillWoodruff29-Dec-14 12:11 
GeneralRe: How to organize this data Pin
SledgeHammer0129-Dec-14 12:28
SledgeHammer0129-Dec-14 12:28 
BillWoodruff wrote:
The result of a Linq statement is not a "concrete instance" of a generic List,
rather it is an internal form of what you might call the "makings of a generic
List:" only when you access the Linq result by, for example, using 'foreach on
its contents, or using .ToList, etc., is an actual final form "rendered."


Yeah, thats why we were saying you shouldn't use .ToList(). You can return an ordered enumeration of the list without "rendering" it.

BillWoodruff wrote:
So, let me get this straight: you object to having a method in a Class that
returns the result of one of several possible sort-orders depending on the value
of an Enum ?


Didn't you do that for syntactic sugar purposes? To make it easier for the caller to return the list? I don't object to encapsulating functionality, I object to doing it in an unknown / custom way when there is a well known, standard way to do it Smile | :) . Just my opinion though. YMMV. As I mentioned, OrderBy(x => x.Y) to me seems easier / shorter then your enum method.

Also, I (perhaps mistakenly?) assumed you implemented that sort functionality in the class itself for use in a UI? Or is it for internal application use? I haven't run across any project yet where the sort order is not either hard-coded in a specific order for internal application use or the sort order is influenced by the user through the UI. Again, just my personal experience. If you have an internal need to sort data differently in different situations, I'd love to hear the use case out of curiousity.

If you did do it for use in a UI, Microsoft already has an established pattern in .Net for filtering and/or sort collections and that ain't it Smile | :) . The pattern doesn't specifically have to be used for UI work, but as I said, its extremely rare to have to sort in different ways unless the user requests it. See ICollectionView.

BillWoodruff wrote:
It's a good thing I'm not your manager, because you are the kind of sledge
hammer I would set to work breaking concrete, rather than writing code Smile | :)


All my code tends to follow well known, established and accepted patterns Smile | :) . I'm kind of a stickler for that.
GeneralRe: How to organize this data Pin
BillWoodruff29-Dec-14 14:18
professionalBillWoodruff29-Dec-14 14:18 
GeneralRe: How to organize this data Pin
SledgeHammer0129-Dec-14 14:58
SledgeHammer0129-Dec-14 14:58 
GeneralRe: How to organize this data Pin
BillWoodruff29-Dec-14 23:44
professionalBillWoodruff29-Dec-14 23:44 
GeneralRe: How to organize this data Pin
SledgeHammer0130-Dec-14 4:13
SledgeHammer0130-Dec-14 4:13 
GeneralRe: How to organize this data Pin
PIEBALDconsult29-Dec-14 13:07
mvePIEBALDconsult29-Dec-14 13:07 
GeneralRe: How to organize this data Pin
BillWoodruff29-Dec-14 23:15
professionalBillWoodruff29-Dec-14 23:15 
GeneralRe: How to organize this data Pin
SledgeHammer0130-Dec-14 4:17
SledgeHammer0130-Dec-14 4:17 
GeneralRe: How to organize this data Pin
BillWoodruff30-Dec-14 23:42
professionalBillWoodruff30-Dec-14 23:42 
GeneralRe: How to organize this data Pin
PIEBALDconsult30-Dec-14 15:29
mvePIEBALDconsult30-Dec-14 15:29 
GeneralRe: How to organize this data Pin
BillWoodruff30-Dec-14 23:53
professionalBillWoodruff30-Dec-14 23:53 
GeneralMessage Closed Pin
29-Dec-14 2:32
Marvic Grima29-Dec-14 2:32 
Questionserial port CreateFile in c# Pin
Member 1114321929-Dec-14 2:16
Member 1114321929-Dec-14 2:16 
AnswerRe: serial port CreateFile in c# Pin
OriginalGriff29-Dec-14 2:28
mveOriginalGriff29-Dec-14 2:28 
GeneralRe: serial port CreateFile in c# Pin
Member 1114321929-Dec-14 2:45
Member 1114321929-Dec-14 2:45 
GeneralRe: serial port CreateFile in c# Pin
Member 1114321929-Dec-14 2:55
Member 1114321929-Dec-14 2:55 
GeneralRe: serial port CreateFile in c# Pin
OriginalGriff29-Dec-14 3:42
mveOriginalGriff29-Dec-14 3:42 
Questionusing SqlConncetion Pin
Jassim Rahma29-Dec-14 1:16
Jassim Rahma29-Dec-14 1:16 

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.