✅ Is managed pointer (ref) or raw pointer (void*) null?
How can I check if a managed pointer or raw pointer points to an already garbage collected address?
```cs
var sample = new Sample();
ref var refToSample = ref Unsafe.AsRef(in sample);
sample = null;
// How to check if sample got garbage collected?
// this is false
bool isNullRef = Unsafe.IsNullRef(ref refToSample);
// How to check if the value the pointer is pointing at is garbage collected?
void* ptr = Unsafe.AsPointer(ref refToSample);
```cs
var sample = new Sample();
ref var refToSample = ref Unsafe.AsRef(in sample);
sample = null;
// How to check if sample got garbage collected?
// this is false
bool isNullRef = Unsafe.IsNullRef(ref refToSample);
// How to check if the value the pointer is pointing at is garbage collected?
void* ptr = Unsafe.AsPointer(ref refToSample);