本文介绍了如何查看.NET实习字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在CLR 2.0,请问有什么办法可以查看所有已实习的琴弦?我看着CLR分析器API和看不到任何API调用监控当一个字符串被拘留。此外,什么是实习字符串的范围有多大?不要实习琴弦收集时,应用程序域被卸载,或者他们跨越应用程序域?

In CLR 2.0, is there any way to view all of the strings that have been interned? I've looked into the CLR Profiler APIs and can't see any API calls to monitor when a string gets interned. Also, what is the scope of interned strings? Do interned strings get collected when the App Domain gets unloaded, or do they span App Domains?

推荐答案

弦确实会默认在.NET 2.0实习,但是这琴弦拘禁时可能是相当复杂的。下面的文章可能会揭开这个概念一些轻:

Strings do get interned by default in .NET 2.0, however which strings get interned and when can be fairly complex. The following article might shed some light on the concept:

http://community.bartdesmet.net/博客/捷运/存档/ 2006/09/27 / 4472.aspx

此外,在问候你的API调用...确保您正在测试与优化构建。调试版本可能不支持字符串默认情况下,这可能是为什么你没有看到它发生实习。

Also, in regards to your API calls...make sure you are testing with an optimized build. A Debug build may not enable string interning by default, which might be why you don't see it happening.

这篇关于如何查看.NET实习字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 05:42