So here, first we have checked whether the employee is null, if yes, we are throwing an ArgumentNullException. Then we need to check whether the employee’s JobRole is set or not. So if the JobRole of employee is null, we are throwing ArgumentException, but not an ArgumentNullException. The reason is even though the property is null, it has made the employee argument itself to invalid.

Well, hope you understood the difference. Even though these are simple things, these things matters when it comes to writing quality code.