|
You could use a HashSet and feed it with each of your original list. Redundant items will be discarded if item is already present. You can even provide your own equality comparer.
If you want to check whether you caught all original items, you can call the IsSupersetOf(IEnumerable) method for all of original lists; it should return true for all of them.
"I'm neither for nor against, on the contrary." John Middle
|
|
|
|
|
- No programming questions in the lounge, and that is what is being asked for despite the wording.
- Dump the data into a single list and select back only distinct items - the platform, tools, etc. are your choice.
|
|
|
|
|
Tim Carmichael wrote: No programming questions in the lounge, and that is what is being asked for despite the wording. That rule does not apply to members above a certain point level.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
HappyFestivus wrote: That rule does not apply to members above a certain point level. Wrong !
«While I complain of being able to see only a shadow of the past, I may be insensitive to reality as it is now, since I'm not at a stage of development where I'm capable of seeing it.» Claude Levi-Strauss (Tristes Tropiques, 1955)
|
|
|
|
|
BillWoodruff wrote: Wrong !
He meant to say reputation, and no I don't mean the numerical thing in our profiles. I get away with lots of things that are supposedly against the rules. Nothing to do with Maunder twice leaving a drinking session before it had really even begun.
Michael Martin
Australia
"I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible."
- Mr.Prakash One Fine Saturday. 24/04/2004
|
|
|
|
|
Nagy Vilmos wrote: Name for the concept
Assuming no duplicates? So, what, "add distinct by"?
public static void AddRangeDistinctBy<T>(this List<T> target, IEnumerable<T> src, Func<T, T, bool> equalityComparer)
{
src.ForEach(item =>
{
if (target.None(q => equalityComparer(q, item)))
{
target.Add(item);
}
});
}
Inefficient and not thread safe but gets the job done.
|
|
|
|
|
That's a great response to a question that should have been asked in another forum !
«While I complain of being able to see only a shadow of the past, I may be insensitive to reality as it is now, since I'm not at a stage of development where I'm capable of seeing it.» Claude Levi-Strauss (Tristes Tropiques, 1955)
|
|
|
|
|
BillWoodruff wrote: That's a great response to a question that should have been asked in another forum !
We'll let it slide for Nagy. Heaven knows, I've gotten away with it.
|
|
|
|
|
Marc Clifton wrote: We'll let it slide for Nagy You walk on water, Nagy walks on air
«While I complain of being able to see only a shadow of the past, I may be insensitive to reality as it is now, since I'm not at a stage of development where I'm capable of seeing it.» Claude Levi-Strauss (Tristes Tropiques, 1955)
|
|
|
|
|
Quote: At some point in their history, the lists diverge Make a list of divergent items.
|
|
|
|
|
Wouldn't this simply be a "Union"?
At least in SQL Server a union merges multiple result sets and filters out duplicate results (unless you use UNION ALL instead of just UNION ).
I'd assume most frameworks employ a similiar concept (at the .Net Linq Method "Union" does this as well)
|
|
|
|
|
What do you think the Algorithms, Linq, and QA, forums are for ?
«While I complain of being able to see only a shadow of the past, I may be insensitive to reality as it is now, since I'm not at a stage of development where I'm capable of seeing it.» Claude Levi-Strauss (Tristes Tropiques, 1955)
|
|
|
|
|
[^]
Get me coffee and no one gets hurt!
modified 6-Dec-17 11:38am.
|
|
|
|
|
When I saw the photo, I thought it was going to be an article about the evil effects on the body of bacon and gin.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
I think the @Mycroft-Holmes has to be inside the message for him to get an email about your post mentioning him.
Michael Martin
Australia
"I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible."
- Mr.Prakash One Fine Saturday. 24/04/2004
|
|
|
|
|
Yah I know where the photo comes from, it is my official Google ID photo as well.
As for being PETA person of the year I can do without it. They are too militant for my taste.
I look forward to a bunch of spam on my google account from this.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Leaves a sign that you've died in The War. (6)
One morning I shot an elephant in my pajamas. How he got in my pajamas, I don't know.
|
|
|
|
|
Fallen?
Fallen leaves - a lot round here.
Fallen in the war?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Nope, sorry.
One morning I shot an elephant in my pajamas. How he got in my pajamas, I don't know.
|
|
|
|
|
|
|
Looks like the winner to me.
This space for rent
|
|
|
|
|
Yup, well done.
One morning I shot an elephant in my pajamas. How he got in my pajamas, I don't know.
|
|
|
|
|
You called?
I have lived with several Zen masters - all of them were cats.
|
|
|
|
|
so what was the 'gotten lumberyard' answer?
|
|
|
|