C#: should object variables be assigned to null?

No, and that could in fact be dangerous and bug-prone (consider the possibility that someone might try to use it later on, not realizing it had been set to null). Only set something to null if there’s a logical reason to set it to null.

Leave a Comment