When doing a null check on an event object, Visual Studio is changing the code color to light grey. If I'm not mistaken , it normally implies that this line is unnecessary. Obviously, it is not the case in my situation (or is it ?). See my example below:
public event PropertyChangedEventHandler PropertyChanged;
string test;
protected void OnPropertyChanged (string propertyName)
{
if (PropertyChanged != null) { //This line is grey
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
} //This line is grey
if (test != null) {
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}