{"id":299,"date":"2007-07-20T14:46:26","date_gmt":"2007-07-20T13:46:26","guid":{"rendered":"http:\/\/soci.hu\/blog\/index.php\/2007\/07\/20\/gyors-pinvoke-string-marshalling-visszafele\/"},"modified":"2007-07-20T14:46:26","modified_gmt":"2007-07-20T13:46:26","slug":"gyors-pinvoke-string-marshalling-visszafele","status":"publish","type":"post","link":"https:\/\/soci.hu\/blog\/index.php\/2007\/07\/20\/gyors-pinvoke-string-marshalling-visszafele\/","title":{"rendered":"Gyors PInvoke string marshalling visszafel\u00e9"},"content":{"rendered":"<p>Mekkora k\u00f6lts\u00e9ge van, ha van egy pointer\u00fcnk egy nat\u00edv stringre, \u00e9s azt vissza akarjuk kapni managed oldalon Sytem.Stringk\u00e9nt? A p\u00e9ld\u00e1ban a string egy delegate-en keresz\u00fcli callback sor\u00e1n j\u00f6n \u00e1t a manazsolt oldalra.<\/p>\n<p>Implict marshall:<\/p>\n<p>    static void Target1(string _str)<br \/>\n    {<br \/>\n    }<\/p>\n<p>K\u00e9zi marshall:<\/p>\n<p>    static void Target2(IntPtr _str)<br \/>\n    {<br \/>\n        string str = Marshal.PtrToStringUni(_str);<br \/>\n    }<\/p>\n<p>Unsafe marshall:<\/p>\n<p>    unsafe static void Target3(IntPtr _str)<br \/>\n    {<br \/>\n        string str = new string((char*)_str);<br \/>\n    } <\/p>\n<p>Az utols\u00f3 megold\u00e1s van, hogy 10x gyorsabb, mint az els\u0151 kett\u0151. Ravasz.<\/p>\n<p><a href=\"http:\/\/blogs.msdn.com\/junfeng\/archive\/2007\/07\/09\/reverse-p-invoke-marshaling-performance.aspx\">Forr\u00e1s<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mekkora k\u00f6lts\u00e9ge van, ha van egy pointer\u00fcnk egy nat\u00edv stringre, \u00e9s azt vissza akarjuk kapni managed oldalon Sytem.Stringk\u00e9nt? A p\u00e9ld\u00e1ban a string&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,4],"tags":[],"class_list":["post-299","post","type-post","status-publish","format-standard","hentry","category-net","category-szakmai-elet"],"_links":{"self":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=299"}],"version-history":[{"count":0,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/299\/revisions"}],"wp:attachment":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}