I have a WCF service that i cannot touch which returns List<FilesWithSettings>
.
I need to enter few PC which are grouped together and retrieve List<FilesWithSettings>
for each one along with PCIdentifier
which brings me to Dictionary<PCIdentifier,List<FilesWithSettings>>
or List<PCIdentifier>
and List<List<FilesWithSettings>>
which isn't elegant and unreadable.
Can you give me more elegant solution ?
One of my inspirations to stop using a to-do list is Peter Drucker, the author of The Effective Executive. When I get too busy with things that I shouldn’t be doing, I remind myself of his classic quote: “There is nothing so useless as doing efficiently that which should not be done at all.”
So if you’re regularly getting overwhelmed with your to-do lists, consider throwing them out. Or, see it as a wake-up call to rethink your work. Most of us can work without a list. I can see why people used the to-do list a hundred years ago. It was their best alternative.
“There is nothing so useless as doing efficiently that which should not be done at all.” T he to-do list is one of the most widely used productivity tactics. For years, I also had a list of dozens of items. When I started researching productivity, I thought the to-do list was a must. “Everyone uses them, so it must work!”
You could use a simple Union + Distinct: That will add all the items from the second list into the first list, and then return all the unique strings in the combined list. Not likely to perform well with large lists, but it's simple.
I guess you've got three options:
List<List<T>> // Which is pretty nasty
or:
Dictionary<PCIdentifier, List<T>>
Which better enunciates your intent or even:
class PCResult
{
PCIdentifier Identifier { get; set; };
List<T> Results { get; set; }
}
and
List<PCResult>
Personally I prefer the third, but the second is fine too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With