Throwing ArgumentNullException in constructor?

前端 未结 4 1708
眼角桃花
眼角桃花 2020-12-08 02:34

For a constructor with a single parameter, is it OK to throw an ArgumentNullException inside the constructor if the parameter is null/empty? OR, should it be thrown in the m

4条回答
  •  一向
    一向 (楼主)
    2020-12-08 02:43

    I'd put the check in the property that you set when the constructor is called... That way the exception would be thrown in all cases.

提交回复
热议问题