当前位置:编程学习 > C#/ASP.NET >>

asp.net中 string.Intern 有什么好处

答案:节省内存,提升运行效率 http://msdn.microsoft.com/zh-cn/library/system.string.intern.aspx
其他:If you are trying to reduce the total amount of memory your application allocates, keep in mind that interning a string has two unwanted side effects. First, the memory allocated for interned String objects is not likely be released until the common language runtime (CLR) terminates. The reason is that the CLR's reference to the interned String object can persist after your application, or even your application domain, terminates. Second, to intern a string, you must first create the string. The memory used by the String object must still be allocated, even though the memory will eventually be garbage collected. 这个方法我也没用过,但是我看他的简介是检索系统对System.String的引用.我估计他是把这个字符串的地址指向了指定的字符串的内存地址,这样这俩字符串就是按引用传递了,就是一个变,另一个不用赋值他也变.因为他俩就成了一个东西的两个名字了..我估计我说的应该易做图不离十了,你可以试一试..

上一个:asp.net 控件Fileupload 怎么上传文件
下一个:asp.net中 常用数据控件有哪些? 谢谢

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,