{"action":"opened","issue":{"url":"https://api.github.com/repos/dotnet/corefx/issues/13216","repository_url":"https://api.github.com/repos/dotnet/corefx","labels_url":"https://api.github.com/repos/dotnet/corefx/issues/13216/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/13216/comments","events_url":"https://api.github.com/repos/dotnet/corefx/issues/13216/events","html_url":"https://github.com/dotnet/corefx/issues/13216","id":186582410,"number":13216,"title":"Add Copy from ref T1 to ref T2 on System.Runtime.CompilerServices.Unsafe (Api)","user":{"login":"xoofx","id":715038,"avatar_url":"https://avatars.githubusercontent.com/u/715038?v=3","gravatar_id":"","url":"https://api.github.com/users/xoofx","html_url":"https://github.com/xoofx","followers_url":"https://api.github.com/users/xoofx/followers","following_url":"https://api.github.com/users/xoofx/following{/other_user}","gists_url":"https://api.github.com/users/xoofx/gists{/gist_id}","starred_url":"https://api.github.com/users/xoofx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xoofx/subscriptions","organizations_url":"https://api.github.com/users/xoofx/orgs","repos_url":"https://api.github.com/users/xoofx/repos","events_url":"https://api.github.com/users/xoofx/events{/privacy}","received_events_url":"https://api.github.com/users/xoofx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-01T16:40:22Z","updated_at":"2016-11-01T16:40:22Z","closed_at":null,"body":"Hi,\r\n\r\nI would like to introduce a new public method for `System.Runtime.CompilerServices.Unsafe`\r\n\r\nBasically something that allows to do something like:\r\n```csharp\r\npublic static void Write<TDest, TSrc>(ref TDest dest, ref TSrc src)\r\n{\r\n    dest = src;\r\n}\r\n```\r\nthat would translate to:\r\n\r\n```csharp\r\n.method public hidebysig static void Write<TDest, TSrc> (!!TDest& dest, !!TSrc& src) cil managed \r\n{\r\n\t.maxstack 2\r\n\tIL_0000: ldarg.0\r\n\tIL_0001: ldarg.1\r\n\tIL_0002: cpobj !!TSrc\r\n\tIL_0007: ret\r\n} \r\n```\r\n\r\nThe usage scenario is to be able to efficiently copy a blittable data of type `TSrc` to a destination of type `TDest`, where we know that `TDest` has enough space to store `TSrc`. This method generates optimal code for such a case and is particularly useful for writing efficient value copy/writer.\r\n\r\nIf this is ok, I can make a PR.\r\nThanks!\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"xoofx"}}