由网友(给你脸你就好好拿着别乱丢)分享简介:我要像做IsItAStringLiteral("yes")var v = "no";IsItAStringLiteral(v)通过明显的返回值。这可能吗?With the obvious return value. Is it possible?推荐答案您可以使用string.IsInterned方法来确定...
我要像做
IsItAStringLiteral("yes")
var v = "no";
IsItAStringLiteral(v)
通过明显的返回值。这可能吗?
With the obvious return value. Is it possible?
推荐答案
您可以使用string.IsInterned方法来确定给定的字符串是否在.NET实习生池。所有字符串自动添加到应用程序之前实习生池开始运行。
You can use the string.IsInterned method to determine whether a given string is in the .NET intern pool. All string literals are automatically added to the intern pool before the application begins running.
当然,这不会帮助您准确的问题。变量'V'将引用一个字符串常量,因此它也将出现在实习生池。为什么需要这样的功能?
Of course, that won't help you with your exact question. Variable 'v' will reference a string literal, so it too will appear in the intern pool. Why do you need such functionality?
相关推荐
最新文章