Click here to Skip to main content
15,886,963 members
Home / Discussions / C#
   

C#

 
GeneralRe: better way to Linqify this ? Pin
BillWoodruff11-Jan-16 8:10
professionalBillWoodruff11-Jan-16 8:10 
GeneralRe: better way to Linqify this ? Pin
PIEBALDconsult11-Jan-16 14:33
mvePIEBALDconsult11-Jan-16 14:33 
GeneralRe: better way to Linqify this ? Pin
Richard Deeming12-Jan-16 1:31
mveRichard Deeming12-Jan-16 1:31 
GeneralRe: better way to Linqify this ? Pin
Jörgen Andersson9-Jan-16 21:32
professionalJörgen Andersson9-Jan-16 21:32 
GeneralRe: better way to Linqify this ? Pin
Richard Deeming11-Jan-16 3:31
mveRichard Deeming11-Jan-16 3:31 
GeneralRe: better way to Linqify this ? Pin
Jörgen Andersson11-Jan-16 6:31
professionalJörgen Andersson11-Jan-16 6:31 
GeneralRe: better way to Linqify this ? Pin
Jörgen Andersson10-Jan-16 11:37
professionalJörgen Andersson10-Jan-16 11:37 
GeneralRe: better way to Linqify this ? Pin
PIEBALDconsult10-Jan-16 14:09
mvePIEBALDconsult10-Jan-16 14:09 
BillWoodruff wrote:
Perhaps it is the case that transforming the IEnumerable to a List<T;> is a good thing to do, if it needs to be evaluated more than once.


Probably not, as that may copy all of the elements, which is just not worth the effort in this case.

I say again; either stop trying to get the Count, or change the parameter type to IList -- it is clear that you (Bill) do not want an IEnumerable at all for the method presented.


Actually, it's good that this discussion came up now because for the last few weeks I have been tweaking some Extension Methods that were accepting IEnumerable and I was concerned about what could be sent in. I have now changed the methods to specify IList and I think everything will be much better.
One of the problems I definitely had when specifying IEnumerable was that String implements IEnumerable, but I did not want to treat it the same as other IEnumerables, which meant testing for is string all the time. By changing to IList (which String does not implement), I no longer need that test.
GeneralRe: better way to Linqify this ? Pin
BillWoodruff11-Jan-16 8:01
professionalBillWoodruff11-Jan-16 8:01 
GeneralRe: better way to Linqify this ? Pin
PIEBALDconsult11-Jan-16 14:32
mvePIEBALDconsult11-Jan-16 14:32 
GeneralRe: better way to Linqify this ? Pin
BillWoodruff11-Jan-16 7:52
professionalBillWoodruff11-Jan-16 7:52 
GeneralRe: better way to Linqify this ? Pin
PIEBALDconsult10-Jan-16 9:56
mvePIEBALDconsult10-Jan-16 9:56 
GeneralRe: better way to Linqify this ? Pin
Jörgen Andersson10-Jan-16 10:55
professionalJörgen Andersson10-Jan-16 10:55 
GeneralRe: better way to Linqify this ? Pin
PIEBALDconsult9-Jan-16 16:05
mvePIEBALDconsult9-Jan-16 16:05 
AnswerRe: better way to Linqify this ? Pin
Luc Pattyn9-Jan-16 6:13
sitebuilderLuc Pattyn9-Jan-16 6:13 
GeneralRe: better way to Linqify this ? Pin
PIEBALDconsult9-Jan-16 16:45
mvePIEBALDconsult9-Jan-16 16:45 
GeneralRe: better way to Linqify this ? Pin
Luc Pattyn9-Jan-16 16:52
sitebuilderLuc Pattyn9-Jan-16 16:52 
GeneralRe: better way to Linqify this ? Pin
Nish Nishant13-Jan-16 10:24
sitebuilderNish Nishant13-Jan-16 10:24 
GeneralRe: better way to Linqify this ? Pin
Luc Pattyn13-Jan-16 12:17
sitebuilderLuc Pattyn13-Jan-16 12:17 
GeneralRe: better way to Linqify this ? Pin
Nish Nishant14-Jan-16 7:25
sitebuilderNish Nishant14-Jan-16 7:25 
AnswerRe: better way to Linqify this ? Pin
Richard Deeming11-Jan-16 3:29
mveRichard Deeming11-Jan-16 3:29 
GeneralRe: better way to Linqify this ? Pin
BillWoodruff11-Jan-16 8:20
professionalBillWoodruff11-Jan-16 8:20 
GeneralRe: better way to Linqify this ? Pin
Richard Deeming11-Jan-16 8:48
mveRichard Deeming11-Jan-16 8:48 
GeneralRe: better way to Linqify this ? Pin
BillWoodruff11-Jan-16 10:27
professionalBillWoodruff11-Jan-16 10:27 
GeneralRe: better way to Linqify this ? Pin
Richard Deeming11-Jan-16 10:52
mveRichard Deeming11-Jan-16 10:52 

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.