String.Intern() method missing in metro 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.

Answers


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

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.


Need Your Help

Cannot use ArrayList of type char as method's argument

java generics

Cannot define ArrayList<char> as argument of validate. Why it cannot be done? When trying ArrayList<?> it works. Why? Should ArrayList<?> be used instead of ArrayList<char>?...

How to prevent jQuery overlading on my site (e.g. by a browser addon)

javascript jquery

I am using jQuery on my website and Honeybadger to get notified about javascript exceptions. The tool shows me many errors that occurr because the global jQuery and $ variables are overwritten by a...