Mercurial > pub > bltoolkit
comparison HowTo/Data/Close.cs @ 0:f990fcb411a9
Копия текущей версии из github
author | cin |
---|---|
date | Thu, 27 Mar 2014 21:46:09 +0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f990fcb411a9 |
---|---|
1 using System; | |
2 using NUnit.Framework; | |
3 using BLToolkit.Data; | |
4 | |
5 namespace HowTo.Data | |
6 { | |
7 [TestFixture] | |
8 public class Close | |
9 { | |
10 [Test] | |
11 public void Test1() | |
12 { | |
13 var db = new DbManager(); | |
14 | |
15 /*[a]*/try/*[/a]*/ | |
16 { | |
17 // ... | |
18 } | |
19 /*[a]*/finally/*[/a]*/ | |
20 { | |
21 if (db != null) | |
22 db./*[a]*/Close/*[/a]*/(); | |
23 } | |
24 } | |
25 | |
26 // Consider using the C# [b][i]using[/i][/b] statement instead. | |
27 // | |
28 [Test] | |
29 public void Test2() | |
30 { | |
31 /*[a]*/using (var db = new DbManager())/*[/a]*/ | |
32 { | |
33 // ... | |
34 } | |
35 } | |
36 } | |
37 } |