中的String.intern()方法在地铁C#失踪 [英] String.Intern() method missing in metro c#

查看:127
本文介绍了中的String.intern()方法在地铁C#失踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获得在地铁C#中的字符串实习生方法。如果在Windows中没有发现8 C#中,有没有保持
系统的参考指定字符串的任何等同方法。

How to get string intern method in Metro c#. if not found in windows 8 c#, is there any equivalent method to maintain system's reference to the specified String.

推荐答案

这是语言投影建成,使API的Metro风格应用.NET的CLR不可避免的副作用。该凸起映射一个从WinRT的API调用System.String而获得的串。底层的字符串不是在所有的托管字符串并没有住在垃圾回收堆。这是一个HSTRING。的语言投影使得它表现得像以System.String

This is an inevitable side-effect of the language projection built into the CLR that enables the ".NET for Metro style apps" api. That projection maps a string that was obtained from a WinRT api call to System.String. The underlying string is not a managed string at all and doesn't live on the garbage collected heap. It is an HSTRING. The language projection makes it behave like a System.String

因此,在该API,String类不具有非常特定于管理串的方法。就像实习生()和IsInterned(),只能用于管理字符串工作。复制,克隆和GetEnumerator的是擅离职守了。有没有办法解决这个,获得了托管String类的mscorlib完全由基准组件阻挡,它就会键入转发到System.Runtime.dll。你必须使它没有这种方法工作。

Accordingly, in that api, the String class doesn't have the methods that are very specific to managed strings. Like Intern() and IsInterned(), that can only work for managed strings. Copy, Clone and GetEnumerator are awol too. There's no workaround for this, access to the managed String class in mscorlib is entirely blocked by the reference assemblies, it gets type forwarded to System.Runtime.dll. You'll have to make it work without that method.

这篇关于中的String.intern()方法在地铁C#失踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆