String.Intern() method missing in metro c#(Metro c#中缺少String.Intern()方法)
问题描述
如何在 Metro 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.
推荐答案
这是 CLR 中内置的语言投影不可避免的副作用,它启用了.NET for Metro 风格应用程序"api.该投影将从 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 类没有非常特定于托管字符串的方法.像 Intern() 和 IsInterned() 一样,它只能用于托管字符串.Copy、Clone 和 GetEnumerator 也一样.对此没有解决方法,对 mscorlib 中托管 String 类的访问完全被引用程序集阻止,它将类型转发到 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.
这篇关于Metro c#中缺少String.Intern()方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Metro c#中缺少String.Intern()方法


基础教程推荐
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- c# Math.Sqrt 实现 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01