您的位置:首页 > 其它

.net 2.0新手学习笔记

2007-02-04 11:37 399 查看
CSDN给出的using 语句(C# 参考)

定义一个范围,将在此范围之外释放一个或多个对象。

using (Font font1 = new Font("Arial", 10.0f))
Font font2 = new Font("Arial", 10.0f);
using (font2)
using (Font font3 = new Font("Arial", 10.0f),
font4 = new Font("Arial", 10.0f))
using System;

class C : IDisposable

class Program
{
static void Main()
{
using (C c = new C())
{
c.UseLimitedResource();
}
Console.WriteLine("Now outside using statement.");
Console.ReadLine();
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: