Skip to content

Reasoning for the docs recommendation of declaring Dispose(bool) #41493

Answered by bartonjs
jnm2 asked this question in General
Discussion options

You must be logged in to vote

The biggest reason is consistency... so that there's not one pattern for types that were declared in 2020 and another for older types.

We had a big discussion about this last winter and that was our basic conclusion: we've had a pattern for 15+ years, and it's too disruptive to change it (and the pattern isn't very expensive).

In addition to having a place where the finalizer could be inserted (though the new Framework Design Guidelines says not to make public types finalizable (but remember: not all types derived from public types are public)), it makes it much clearer when a type /does/ introduce a finalizer where the SuppressFinalize goes: the place that originally declared it was IDis…

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@svick
Comment options

@jnm2
Comment options

Answer selected by jnm2
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants