using System;
using NUnit.Framework;
using BLToolkit.Data;
namespace HowTo.Data
{
[TestFixture]
public class Close
{
[Test]
public void Test1()
{
DbManager db = new DbManager();
try
{
// ...
}
finally
{
if (db != null)
db.Close();
}
}
// Consider using the C# using statement instead.
//
[Test]
public void Test2()
{
using (DbManager db = new DbManager())
{
// ...
}
}
}
} |