{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/coreclr/issues/1165","labels_url":"https://api.github.com/repos/dotnet/coreclr/issues/1165/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/1165/comments","events_url":"https://api.github.com/repos/dotnet/coreclr/issues/1165/events","html_url":"https://github.com/dotnet/coreclr/issues/1165","id":89966506,"number":1165,"title":"Add Move method to List<T>","user":{"login":"omariom","id":1781701,"avatar_url":"https://avatars.githubusercontent.com/u/1781701?v=3","gravatar_id":"","url":"https://api.github.com/users/omariom","html_url":"https://github.com/omariom","followers_url":"https://api.github.com/users/omariom/followers","following_url":"https://api.github.com/users/omariom/following{/other_user}","gists_url":"https://api.github.com/users/omariom/gists{/gist_id}","starred_url":"https://api.github.com/users/omariom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omariom/subscriptions","organizations_url":"https://api.github.com/users/omariom/orgs","repos_url":"https://api.github.com/users/omariom/repos","events_url":"https://api.github.com/users/omariom/events{/privacy}","received_events_url":"https://api.github.com/users/omariom/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-06-21T22:02:00Z","updated_at":"2015-06-26T18:38:29Z","closed_at":null,"body":"There  are plenty of convenience methods in generic List. But no Move method that can efficiently move an item from one position to another.\r\nWhat we have to do is [RemoveAt and Insert](https://github.com/dotnet/corefx/blob/master/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs#L200). It means two copies of big chunks of memory instead of one. The worst case is when both **from** and **to** are close to each other and to the beginning of a large list. What could be done with one copy  of a few items becomes two copies of almost the whole list.\r\nIn my implementation of ObservableCollection.MoveItem I had to get the underlying List, retrieve via reflection :see_no_evil: its array and  do the work myself. \r\n \r\nSo.. **I propose adding new Move method to generic List with the following signature:**\r\n```C#\r\npublic void Move(int oldIndex, int newIndex);\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/dotnet/coreclr/issues/comments/115827288","html_url":"https://github.com/dotnet/coreclr/issues/1165#issuecomment-115827288","issue_url":"https://api.github.com/repos/dotnet/coreclr/issues/1165","id":115827288,"user":{"login":"KrzysztofCwalina","id":9724236,"avatar_url":"https://avatars.githubusercontent.com/u/9724236?v=3","gravatar_id":"","url":"https://api.github.com/users/KrzysztofCwalina","html_url":"https://github.com/KrzysztofCwalina","followers_url":"https://api.github.com/users/KrzysztofCwalina/followers","following_url":"https://api.github.com/users/KrzysztofCwalina/following{/other_user}","gists_url":"https://api.github.com/users/KrzysztofCwalina/gists{/gist_id}","starred_url":"https://api.github.com/users/KrzysztofCwalina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KrzysztofCwalina/subscriptions","organizations_url":"https://api.github.com/users/KrzysztofCwalina/orgs","repos_url":"https://api.github.com/users/KrzysztofCwalina/repos","events_url":"https://api.github.com/users/KrzysztofCwalina/events{/privacy}","received_events_url":"https://api.github.com/users/KrzysztofCwalina/received_events","type":"User","site_admin":false},"created_at":"2015-06-26T18:38:29Z","updated_at":"2015-06-26T18:38:29Z","body":"I think some kind of \"move\" API is worth exploring. But I think it would be great if somebody thought about a more general API than simple \"move one items from here to there\". For example, what if I want to move a slice/range? what if I want to swap two ranges? What if I want to round robin move three items? BTW, I am not proposing that we actually implement all these, often corner case, scenarios, but it would be good to have a good overview of the \"move\" scenarios and chose to implement the ones that are common and where we can get good performance improvement while preserving simplicity."}}