8
8
/// </summary>
9
9
public abstract class Disposable : IDisposable
10
10
{
11
- #region Fields
12
- private static readonly ILog Log = LogProvider . GetCurrentClassLogger ( ) ;
11
+ static readonly ILog Log = LogProvider . GetCurrentClassLogger ( ) ;
13
12
14
- private readonly object _syncRoot = new object ( ) ;
13
+ readonly object _syncRoot = new object ( ) ;
15
14
16
- private bool _disposing ;
17
- #endregion
18
-
19
- #region Constructors
15
+ bool _disposing ;
16
+
20
17
/// <summary>
21
18
/// Finalizes an instance of the <see cref="Disposable"/> class.
22
19
/// </summary>
23
20
~ Disposable ( )
24
21
{
25
22
Dispose ( false ) ;
26
23
}
27
- #endregion
28
-
29
- #region Properties
30
- private bool IsDisposed { get ; set ; }
31
- #endregion
24
+
25
+ bool IsDisposed { get ; set ; }
32
26
33
- #region Methods
34
27
/// <summary>
35
28
/// Disposes this instance.
36
29
/// </summary>
@@ -40,21 +33,6 @@ public void Dispose()
40
33
GC . SuppressFinalize ( this ) ;
41
34
}
42
35
43
- /// <summary>
44
- /// Checks whether the object is disposed. If so, it will throw the <see cref="ObjectDisposedException"/>.
45
- /// </summary>
46
- /// <exception cref="System.ObjectDisposedException">The object is disposed.</exception>
47
- protected void CheckDisposed ( )
48
- {
49
- lock ( _syncRoot )
50
- {
51
- if ( IsDisposed )
52
- {
53
- throw new ObjectDisposedException ( GetType ( ) . FullName ) ;
54
- }
55
- }
56
- }
57
-
58
36
/// <summary>
59
37
/// Disposes the managed resources.
60
38
/// </summary>
@@ -73,7 +51,7 @@ protected virtual void DisposeUnmanaged()
73
51
/// Releases unmanaged and - optionally - managed resources.
74
52
/// </summary>
75
53
/// <param name="isDisposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
76
- private void Dispose ( bool isDisposing )
54
+ void Dispose ( bool isDisposing )
77
55
{
78
56
lock ( _syncRoot )
79
57
{
@@ -91,11 +69,6 @@ private void Dispose(bool isDisposing)
91
69
}
92
70
catch ( Exception ex )
93
71
{
94
- //if (ex.IsCritical())
95
- //{
96
- // throw;
97
- //}
98
-
99
72
Log . ErrorException ( "Error while disposing managed resources of '{0}'." , ex , GetType ( ) . FullName ) ;
100
73
}
101
74
}
@@ -106,11 +79,6 @@ private void Dispose(bool isDisposing)
106
79
}
107
80
catch ( Exception ex )
108
81
{
109
- //if (ex.IsCritical())
110
- //{
111
- // throw;
112
- //}
113
-
114
82
Log . ErrorException ( "Error while disposing unmanaged resources of '{0}'." , ex , GetType ( ) . FullName ) ;
115
83
}
116
84
@@ -120,6 +88,5 @@ private void Dispose(bool isDisposing)
120
88
}
121
89
}
122
90
}
123
- #endregion
124
91
}
125
92
}
0 commit comments