This is my model:
public class EventModel
{
public DateTime? EVENT_DATE { get; set; }
public decimal? EVENT_TYPE { get; set; }
public string EVENT_DESCRIPTION { get; set; }
}
I fill this class into ObservableCollection<EventModel>
. When I do that, I also deep-copy same collection. Then I want to compare these two collections in later use.
I would preferably use LINQ to do that, with something like
bool are_same = collection1.OrderBy(i => i).SequenceEqual(
collection2.OrderBy(i => i));
This means that both collections needs to be sorted and then compared to each other for finding differencies in ALL PROPERTIES
.
There are a lot of examples for implementing IComparable & IEqualityComparer
, but I'm confused about what I need and how.
I would appreciate If someone would show me how this can be done in C#.