Skip to content

Comparing a ref to null? #2401

Discussion options

You must be logged in to vote

You can only get a null ref (that is a ref which is null; rather than a reference to a null) via unsafe means today. For example, using Unsafe.AsRef<T>(null) or via interop code involving ref returns.

Likewise, you need to use the Unsafe class to check if you have a null ref.

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by YairHalberstadt
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
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
3 participants
Converted from issue

This discussion was converted from issue #2401 on October 26, 2020 11:13.