Prefer
public class Order
{
public OrderLine AddOrderLine(OrderLine orderLine)
{
if (orderLine == null) throw new ArgumentNullException(nameof(orderLine));
...
}
}
Over
public class Order
{
public OrderLine AddOrderLine(OrderLine orderLine)
{
if (orderLine == null) throw new ArgumentNullException("orderLine");
...
}
}
Using the nameof
feature makes it easier to refactor method parameters.