Skip to content

Prevent IDisposable structs from being boxed #8337

Closed Answered by colejohnson66
AFatNiBBa asked this question in Language Ideas
Discussion options

You must be logged in to vote

((IDisposable)something).Dispose() does not box. It’s a "constrained call" and the JIT elides the actual boxing.

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
7 replies
@huoyaoyuan
Comment options

@bbarry
Comment options

@siegfriedpammer
Comment options

@colejohnson66
Comment options

@timcassell
Comment options

Answer selected by AFatNiBBa
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
6 participants