When refactoring code, I come up with instances like the following
private string _property = string.Empty;
public string Property
{
set { _property = value ?? string.Empty); }
}
Later on in a method I see the following:
if (_property != null)
{
//...
}
Assuming that _property
is only set by the setter of Property
, is this code redundant?
I.e is there any way, through reflection wizardry or other methods that _property
can ever be null?
Aucun commentaire:
Enregistrer un commentaire