In the list you want to perform the comparison against, override Equals
[Serializable] public class AlertSubscriptionOption { .. . /// <summary> /// Determines whether the specified <see cref="System.Object" />, is equal to this instance. /// </summary> /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param> /// <returns> /// <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>. /// </returns> public override bool Equals(object obj) { // Check for null values and compare run-time types. if (obj == null || GetType() != obj.GetType()) return false; AlertSubscriptionOption p = (AlertSubscriptionOption)obj; return this.SubType == p.SubType; }
Now, to compare the 2 lists, perform the following
bool subscriptionEmailDifferent = false; subscriptionEmailDifferent = (newSubscriptionEmailOptions.Count > 0 || oldSubscriptionEmailOptions.Count > 0) && !newSubscriptionEmailOptions.OrderBy(x => x.SubType).ToList().SequenceEqual(oldSubscriptionEmailOptions.OrderBy(x => x.SubType).ToList());
References:
http://stackoverflow.com/questions/12795882/quickest-way-to-compare-two-list
http://stackoverflow.com/questions/188141/list-orderby-alphabetical-order