ex-04-06

来自「Programming Csharp Source Code(代码) Prog」· 代码 · 共 25 行

TXT
25
字号
//Example 04-06: The using construct

using System.Drawing;
class Tester
{
   public static void Main()
   {
      using (Font theFont = new Font("Arial", 10.0f))
      {
         // use theFont

      }   // compiler will call Dispose on theFont

      Font anotherFont = new Font("Courier",12.0f);
    
      using (anotherFont)
      {
         // use anotherFont

      }  // compiler calls Dispose on anotherFont

   }
 
}

⌨️ 快捷键说明

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