You are calling a member of a member - reidev275/SignsYouShouldProbablyRefactor GitHub Wiki

Example

void ConfigureRequest(HttpWebRequest request)
{
 if (request == null) throw new ArgumentNullException("request");
 request.Method = "POST";
 request.Headers.Add("header", "value");
}

Why is this bad?

  1. Very easy for a null reference exception.
  2. Potentially confusing api. (Should I set the Headers property or call methods on the property?)
  3. Chance that we're operating at the wrong level of abstraction.