⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 3.7.txt

📁 《Microsoft Visual C# .NET 2003开发技巧大全》源代码
💻 TXT
字号:
Listing 3.7 Interning a String by Using the Intern Method
using System;
namespace _7_StringBuilder
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
string sLiteral = “Automatically Interned”;
string sNotInterned = “Not “ + sLiteral;
TestInterned( sLiteral );
TestInterned( sNotInterned );
String.Intern( sNotInterned );
TestInterned( sNotInterned );
}
static void TestInterned( string str )
{
if( String.IsInterned( str ) != null )
{
Console.WriteLine( “The string \”{0}\” is interned.”, str );
}
else
{
Console.WriteLine( “The string \”{0}\” is not interned.”, str );
}
}
}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -