{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/corefx/issues/5104","labels_url":"https://api.github.com/repos/dotnet/corefx/issues/5104/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/5104/comments","events_url":"https://api.github.com/repos/dotnet/corefx/issues/5104/events","html_url":"https://github.com/dotnet/corefx/issues/5104","id":123610470,"number":5104,"title":"ReadOnlyDictionary should be located at System.Runtime","user":{"login":"yfakariya","id":514866,"avatar_url":"https://avatars.githubusercontent.com/u/514866?v=3","gravatar_id":"","url":"https://api.github.com/users/yfakariya","html_url":"https://github.com/yfakariya","followers_url":"https://api.github.com/users/yfakariya/followers","following_url":"https://api.github.com/users/yfakariya/following{/other_user}","gists_url":"https://api.github.com/users/yfakariya/gists{/gist_id}","starred_url":"https://api.github.com/users/yfakariya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yfakariya/subscriptions","organizations_url":"https://api.github.com/users/yfakariya/orgs","repos_url":"https://api.github.com/users/yfakariya/repos","events_url":"https://api.github.com/users/yfakariya/events{/privacy}","received_events_url":"https://api.github.com/users/yfakariya/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-23T06:51:28Z","updated_at":"2015-12-23T12:03:17Z","closed_at":null,"body":"I found and confused about location of collection interfaces and their implementations in class library nuget packages.\r\n* Collection interfaces including `IReadOnlyDictionary<TKey, TValue>` are defined in `System.Runtime` assembly, it is perfect.\r\n* (Generic) collection implementations are defined in `System.Collections` assembly, it also OK.\r\n* `INotifyCollectionChanged` and its implementation (`ObservableCollection<T>`) is defined in `System.ObjectModel`, it is no problem.\r\n* `Collection<T>` and `ReadOnlyCollection<T>` are defined in `System.Runtime`, and `ReadOnlyDictionary<TKey, TValue>` is defined in `System.ObjectModel`.\r\n\r\nIt causes unnecessary dependency from apps to `System.ObjectModel` when apps just want to use read only dictionary. At least, `ReadOnlyDictionary<TKey, TValue>` should be located together with `ReadOnlyCollection<T>`."},"comment":{"url":"https://api.github.com/repos/dotnet/corefx/issues/comments/166876426","html_url":"https://github.com/dotnet/corefx/issues/5104#issuecomment-166876426","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/5104","id":166876426,"user":{"login":"aevitas","id":151426,"avatar_url":"https://avatars.githubusercontent.com/u/151426?v=3","gravatar_id":"","url":"https://api.github.com/users/aevitas","html_url":"https://github.com/aevitas","followers_url":"https://api.github.com/users/aevitas/followers","following_url":"https://api.github.com/users/aevitas/following{/other_user}","gists_url":"https://api.github.com/users/aevitas/gists{/gist_id}","starred_url":"https://api.github.com/users/aevitas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aevitas/subscriptions","organizations_url":"https://api.github.com/users/aevitas/orgs","repos_url":"https://api.github.com/users/aevitas/repos","events_url":"https://api.github.com/users/aevitas/events{/privacy}","received_events_url":"https://api.github.com/users/aevitas/received_events","type":"User","site_admin":false},"created_at":"2015-12-23T12:03:17Z","updated_at":"2015-12-23T12:03:17Z","body":"> As you say, it is OK to expose read only dictionary in API with interface, but we eventually use implementation (that is ReadOnlyDictionary class) for it.\r\n\r\nNot necessarily, `Dictionary<TKey, TValue>` implements `IReadOnlyDictionary<TKey, TValue>` as well (same with `List<T>` and `IReadOnlyList<T>`), therefore, it is perfectly fine to expose a regular dictionary as an immutable dictionary in public API like so:\r\n\r\n\t\tprivate readonly Dictionary<string, int> _dictionary = new Dictionary<string, int>();\r\n\t\tpublic IReadOnlyDictionary<string, int> Dictionary => _dictionary; \r\n\r\nI'm not sure how common it is to use `ReadOnlyCollection<TKey, TValue>` and `Collection<TKey, TValue>` as actual collections instead of their System.Collections.Generic counterparts. I've personally never used the former in production software - they don't appear to me as types that intended for end-use, but that's something one of the repository contributors should probably comment on."}}