Skip to content

Commit cb8ac53

Browse files
committed
Upgraded to NET 8
1 parent 52831c9 commit cb8ac53

8 files changed

Lines changed: 151 additions & 150 deletions

File tree

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ Create a class and inherit from **DisposableObject** as shown below:
1313
{
1414
protected override void OnDisposeManagedObjects()
1515
{
16-
// ***
17-
// *** Disposed CLR managed objects here.
18-
// ***
16+
//
17+
// Disposed CLR managed objects here.
18+
//
1919
}
2020

2121
protected override void OnDisposeUnmanagedObjects()
2222
{
23-
// ***
24-
// *** Disposed non-CLR managed objects here.
25-
// ***
23+
//
24+
// Disposed non-CLR managed objects here.
25+
//
2626
}
2727
}
2828

@@ -32,9 +32,9 @@ When instantiating the class. wrap it in a using statement.
3232

3333
using (SomeObject obj = new SomeObject())
3434
{
35-
// ***
36-
// *** obj will be disposed and the dispose
37-
// *** methods will be called.
35+
//
36+
// obj will be disposed and the dispose
37+
// methods will be called.
3838
}
3939

4040
or call the Dispose() method.

Src/System.DisposableObject Solution/System.DisposableObject.Example/Program.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ static void Main(string[] args)
66
{
77
using (SomeObject obj1 = new())
88
{
9-
// ***
10-
// *** obj will be disposed and the dispose
11-
// *** methods will be called.
9+
//
10+
// obj will be disposed and the dispose
11+
// methods will be called.
1212
}
1313

1414
using (SomeAsyncObject obj2 = new())
1515
{
16-
// ***
17-
// *** obj will be disposed and the dispose
18-
// *** methods will be called.
16+
//
17+
// obj will be disposed and the dispose
18+
// methods will be called.
1919
}
2020
}
2121
}

Src/System.DisposableObject Solution/System.DisposableObject.Example/SomeAsyncObject.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ public class SomeAsyncObject : AsyncDisposableObject
66
{
77
protected override void OnDisposeManagedObjects()
88
{
9-
// ***
10-
// *** Disposed CLR managed objects here.
11-
// ***
9+
//
10+
// Disposed CLR managed objects here.
11+
//
1212
}
1313

1414
protected override void OnDisposeUnmanagedObjects()
1515
{
16-
// ***
17-
// *** Disposed non-CLR managed objects here.
18-
// ***
16+
//
17+
// Disposed non-CLR managed objects here.
18+
//
1919
}
2020
}
2121
}

Src/System.DisposableObject Solution/System.DisposableObject.Example/SomeObject.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ public class SomeObject : DisposableObject
66
{
77
protected override void OnDisposeManagedObjects()
88
{
9-
// ***
10-
// *** Disposed CLR managed objects here.
11-
// ***
9+
//
10+
// Disposed CLR managed objects here.
11+
//
1212
}
1313

1414
protected override void OnDisposeUnmanagedObjects()
1515
{
16-
// ***
17-
// *** Disposed non-CLR managed objects here.
18-
// ***
16+
//
17+
// Disposed non-CLR managed objects here.
18+
//
1919
}
2020
}
2121
}

Src/System.DisposableObject Solution/System.DisposableObject.Example/System.DisposableObject.Example.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<Version>8.0.0</Version>
7+
<FileVersion>8.0.0</FileVersion>
8+
<AssemblyVersion>8.0.0</AssemblyVersion>
69
</PropertyGroup>
710

811
<ItemGroup>
Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
// ***
2-
// *** Copyright(C) 2017-2021, Daniel M. Porrey. All rights reserved.
3-
// **
4-
// *** This program is free software: you can redistribute it and/or modify
5-
// *** it under the terms of the GNU Lesser General Public License as published
6-
// *** by the Free Software Foundation, either version 3 of the License, or
7-
// *** (at your option) any later version.
8-
// ***
9-
// *** This program is distributed in the hope that it will be useful,
10-
// *** but WITHOUT ANY WARRANTY; without even the implied warranty of
11-
// *** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12-
// *** GNU Lesser General Public License for more details.
13-
// ***
14-
// *** You should have received a copy of the GNU Lesser General Public License
15-
// *** along with this program. If not, see http://www.gnu.org/licenses/.
16-
// ***
17-
#if (NET5_0 || NET6_0)
1+
//
2+
// Copyright(C) 2017-2021, Daniel M. Porrey. All rights reserved.
3+
//
4+
// This program is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU Lesser General Public License as published
6+
// by the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// This program is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU Lesser General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU Lesser General Public License
15+
// along with this program. If not, see http://www.gnu.org/licenses/.
16+
//
1817
using System.Diagnostics;
1918
using System.Threading.Tasks;
2019

@@ -34,9 +33,9 @@ public abstract class AsyncDisposableObject : DisposableObject, IAsyncDisposable
3433
/// </summary>
3534
public AsyncDisposableObject()
3635
{
37-
// ***
38-
// *** Set this to True for debugging.
39-
// ***
36+
//
37+
// Set this to True for debugging.
38+
//
4039
this.AssertWhenNotDisposed = false;
4140
}
4241

@@ -45,25 +44,25 @@ public AsyncDisposableObject()
4544
/// </summary>
4645
~AsyncDisposableObject()
4746
{
48-
// ***
49-
// *** Write a trace (to the debugger) showing this method was called (it will only
50-
// *** get called if this object is not Disposed).
51-
// ***
47+
//
48+
// Write a trace (to the debugger) showing this method was called (it will only
49+
// get called if this object is not Disposed).
50+
//
5251
Trace.TraceWarning("~BaseObject called on {0}", this.OnGetClassName());
5352

54-
// ***
55-
// *** Give the parent object a chance to respond, if not then this
56-
// *** class will assert.
57-
// ***
53+
//
54+
// Give the parent object a chance to respond, if not then this
55+
// class will assert.
56+
//
5857
if (this.AssertWhenNotDisposed)
5958
{
6059
if (!this.OnNotDisposedProperly())
6160
{
62-
// ***
63-
// *** Assert if this object is destroyed without being disposed. Even though
64-
// *** dispose is called here, it is more ideal that it be called by the user
65-
// *** of the object. This assert will help catch this instance.
66-
// ***
61+
//
62+
// Assert if this object is destroyed without being disposed. Even though
63+
// dispose is called here, it is more ideal that it be called by the user
64+
// of the object. This assert will help catch this instance.
65+
//
6766
Trace.Assert(this.IsDisposed, this.OnGetClassName() + " was not disposed properly.");
6867
}
6968
else
@@ -72,11 +71,11 @@ public AsyncDisposableObject()
7271
}
7372
}
7473

75-
// ***
76-
// *** This destructor is only called by garbage collection. Because of this, this object
77-
// *** can no longer access managed objects. Only unmanaged objects will be cleaned up
78-
// *** here.
79-
// ***
74+
//
75+
// This destructor is only called by garbage collection. Because of this, this object
76+
// can no longer access managed objects. Only unmanaged objects will be cleaned up
77+
// here.
78+
//
8079
this.Dispose(false);
8180
}
8281

@@ -91,5 +90,4 @@ public virtual ValueTask DisposeAsync()
9190
return ValueTask.CompletedTask;
9291
}
9392
}
94-
}
95-
#endif
93+
}

0 commit comments

Comments
 (0)