Skip to content

Commit 0f575e0

Browse files
Add Destructor to SerialPort class (#102)
***NO_CI***
1 parent 1976d1c commit 0f575e0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

System.IO.Ports/SerialPort.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,14 @@ internal static SerialPort FindDevice(int index)
771771
return null;
772772
}
773773

774+
/// <summary>
775+
/// Destructor.
776+
/// </summary>
777+
~SerialPort()
778+
{
779+
Dispose(false);
780+
}
781+
774782
/// <summary>
775783
/// Releases the unmanaged resources used by the <see cref="SerialPort"/> and optionally
776784
/// releases the managed resources.

0 commit comments

Comments
 (0)