Feb 26, 2016 12:12 AM|PaulTheSmith|LINK
It seems that you want PRDSProjectColumns to be a value type. For example, you have created two separate instances of PRDSProjectColumns both with the ColumnName of "Project Description" and added one instance to one variable and the other instance to another. But
you want them to be considered the same.
(If you set x=5 and y=5 you want x and y to be considered equal - there is only one '5' in the universe. If you set x=John Smith and y = John Smith then you want them to be considered different - there is more than one John Smith in the universe.)
Add these two methods to you PRDSProjectColumns class
public override bool Equals(object other)
if (!(other is PRDSProjectColumns)) return false;
return this.ColumnName.Equals((other as PRDSProjectColumns).ColumnName);
public override int GetHashCode()
Now .Except will work as you want (with having to create the Comparer) because PRRDSProjectColumns will behave as a value type.
(you might consider overriding == and != to make other comparisons easier as well)
(PS - My 2c, use a singular name for this sort of class - PRRRDSProjectColumn would be better. Reserve plural names for things which are collections.)