Syntactic sugar for Unsafe.IsNullRef
and Unsafe.NullRef
#7183
Replies: 2 comments 9 replies
-
I would be opposed to any sugar into |
Beta Was this translation helpful? Give feedback.
-
Note that the CLI spec explicitly disallows
The CLI spec also disallows quite a few things around It's true that the existence of |
Beta Was this translation helpful? Give feedback.
-
Yesterday I created a discussion (#7181) for
ref var
pattern matching. I found that sometimes I may use the following statement to check whether a reference is not a null ref:Because reference is not a type, it is a concept that describe a pointing relation. Therefore I cannot use a simpler way to define it (for example, using pattern matching).
If we can create a
null
reference simpler, or check it simpler? For example, useref null
combined keywords to define a reference tonull
:Check whether a reference is
null
:Or even for an expression:
I personally think that null ref is common to be defined as "default value" of a
ref
variable. Today it's difficult to detect whether a reference is anull
reference, so I often use this method to check for this. But I don't think that always writing method invocation is a good and convenient.Thank you.
Beta Was this translation helpful? Give feedback.
All reactions