23 April 2023
Nulls and Exceptions, a horrific yet most popular combination in C#:
public CookieValueProvider(HttpActionContext actionContext)
{
if (actionContext == null)
{
throw new ArgumentNullException("actionContext");
}
// [...] Remaining code removed for clarity.
}
null
check, because the compiler is kind enough to
allow the caller to pass in this non-value, and, who knows, the caller
might actually pass in this no-value.Exception
throwing (rather than returning an error),
well, to make the caller’s life a bit more interesting (because why
leverage compile-time guarantees :-P).