{"action":"created","issue":{"url":"https://api.github.com/repos/RolandPheasant/DynamicData/issues/110","repository_url":"https://api.github.com/repos/RolandPheasant/DynamicData","labels_url":"https://api.github.com/repos/RolandPheasant/DynamicData/issues/110/labels{/name}","comments_url":"https://api.github.com/repos/RolandPheasant/DynamicData/issues/110/comments","events_url":"https://api.github.com/repos/RolandPheasant/DynamicData/issues/110/events","html_url":"https://github.com/RolandPheasant/DynamicData/issues/110","id":307736147,"number":110,"title":"Question: Why need the EqualityComparer for SourceCache.EditDiff()","user":{"login":"shtse8","id":8020099,"avatar_url":"https://avatars1.githubusercontent.com/u/8020099?v=4","gravatar_id":"","url":"https://api.github.com/users/shtse8","html_url":"https://github.com/shtse8","followers_url":"https://api.github.com/users/shtse8/followers","following_url":"https://api.github.com/users/shtse8/following{/other_user}","gists_url":"https://api.github.com/users/shtse8/gists{/gist_id}","starred_url":"https://api.github.com/users/shtse8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shtse8/subscriptions","organizations_url":"https://api.github.com/users/shtse8/orgs","repos_url":"https://api.github.com/users/shtse8/repos","events_url":"https://api.github.com/users/shtse8/events{/privacy}","received_events_url":"https://api.github.com/users/shtse8/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-03-22T17:11:22Z","updated_at":"2018-03-27T21:48:36Z","closed_at":null,"author_association":"NONE","body":"First of all, thanks to your rich library and it helps my a lots for managing collections.\r\n\r\nAfter studying the documentation and some tries, I would like to sync two list (including updates, adds and removes). I have implemented my own extension like this:\r\n```C#\r\n        public static void EditSync<TItem, TKey>(this SourceCache<TItem, TKey> oldItems, IEnumerable<TItem> newItems)\r\n        {\r\n            oldItems.Edit(innerList =>\r\n            {\r\n                newItems = newItems.AsArray();\r\n                var removeItems = innerList.Items.Except(newItems);\r\n                innerList.Remove(removeItems);\r\n                innerList.AddOrUpdate(newItems);\r\n            });\r\n        }\r\n```\r\n\r\nAfter that, I have found there is a `EditDiff` method for doing the same thing. But the only difference is it needs a EqualityComparer, I don't know what some I put it there because I have already given the key to the `SourceCache` constructor.\r\n\r\nSo I decided reading the source code to figure out the reason.\r\nhttps://github.com/RolandPheasant/DynamicData/blob/ec88df33d5a062296015ed5b3bd82ac70db24e91/DynamicData/Cache/Internal/EditDiff.cs#L21-L41\r\n\r\nStill, I don't understand what is the reason behind. Could someone can give me a kindly explanation why we need to calculate the intersect and using the EqualityComparer to compare the values? And what I should pass it there if I just want to compare the key? Thanks."},"comment":{"url":"https://api.github.com/repos/RolandPheasant/DynamicData/issues/comments/376687112","html_url":"https://github.com/RolandPheasant/DynamicData/issues/110#issuecomment-376687112","issue_url":"https://api.github.com/repos/RolandPheasant/DynamicData/issues/110","id":376687112,"user":{"login":"shtse8","id":8020099,"avatar_url":"https://avatars1.githubusercontent.com/u/8020099?v=4","gravatar_id":"","url":"https://api.github.com/users/shtse8","html_url":"https://github.com/shtse8","followers_url":"https://api.github.com/users/shtse8/followers","following_url":"https://api.github.com/users/shtse8/following{/other_user}","gists_url":"https://api.github.com/users/shtse8/gists{/gist_id}","starred_url":"https://api.github.com/users/shtse8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shtse8/subscriptions","organizations_url":"https://api.github.com/users/shtse8/orgs","repos_url":"https://api.github.com/users/shtse8/repos","events_url":"https://api.github.com/users/shtse8/events{/privacy}","received_events_url":"https://api.github.com/users/shtse8/received_events","type":"User","site_admin":false},"created_at":"2018-03-27T21:48:36Z","updated_at":"2018-03-27T21:48:36Z","author_association":"NONE","body":"Oh, I am wrong. I should use `MergeMany` instead if I want to watch the items."}}
{"actor":{"display_login":"shtse8"}}