How do I perform a null-check on a dynamic object?
Pseudo code:
public void Main() {
dynamic dynamicObject = 33;
if(true) { // Arbitrary logic
dynamicObject = null;
}
Method(dynamicObject);
}
public void Method(dynamic param) {
// TODO: check if the content of 'param' is equal to null
}
Are you worried about the possibility the dynamic object will have a custom equality operator that will change the way the
nullis interpreted? If so just useObject.ReferenceEquals