rspec/rules/S1048/how-dotnet.adoc
2023-07-05 13:49:21 +02:00

18 lines
850 B
Plaintext

== How to fix it
=== Code examples
==== Noncompliant code example
include::{language}/noncompliant-code.adoc[]
==== Compliant solution
include::{language}/compliant-code.adoc[]
=== Going the extra mile
In general object finalization can be a complex and error-prone operation and should not be implemented except within the https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-dispose[dispose pattern].
When https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/unmanaged[cleaning up unmanaged resources], it is recommended to implement the dispose pattern or, to cover uncalled https://learn.microsoft.com/en-us/dotnet/api/system.idisposable.dispose[`Dispose`] method by the consumer, implement https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.safehandle[`SafeHandle`].