N
Niall
Ok, maybe this is getting too lazy and too demanding, but hey, I thought I'd
see what people thought about it.
Would anyone else find a syntax like:
foreach (string Name in CompanyNames and EmployeeNames and ...)
{
etc
}
useful? I know that on some collections, you can append, insert etc. But
it's not always the case that you have such collections when you are
enumerating. Also, often you do not want to change one of the original
collections by appending the elements from the other collection.
So you are left with two choices. Make a new collection and stuff in all the
combined elements you want, which will be a performance hit. Or write the
foreach loop once for each collection you want to go through, which results
in code duplication, increasing likelihood of refactoring causing bugs. I
think the "and" syntax would provide a simple, succinct and very readable
alternative to this...
Unless, of course, I'm on crack and there's some easy way to do this that
I've overlooked?
Niall
see what people thought about it.
Would anyone else find a syntax like:
foreach (string Name in CompanyNames and EmployeeNames and ...)
{
etc
}
useful? I know that on some collections, you can append, insert etc. But
it's not always the case that you have such collections when you are
enumerating. Also, often you do not want to change one of the original
collections by appending the elements from the other collection.
So you are left with two choices. Make a new collection and stuff in all the
combined elements you want, which will be a performance hit. Or write the
foreach loop once for each collection you want to go through, which results
in code duplication, increasing likelihood of refactoring causing bugs. I
think the "and" syntax would provide a simple, succinct and very readable
alternative to this...
Unless, of course, I'm on crack and there's some easy way to do this that
I've overlooked?
Niall