2 comments on “Cleaner constructors with throw expressions in C# 7

  1. I think, that in these days this isn’t a big issue. In ninety percent of apps we use IOC containers, to construct the logical (those doing stuff 😉 ) part of objects. So instead of nullcheck i would expect rather an exception after resolve fail. Also, in predictet failure points, i much prefer an Integration checks on stratup. This give me confidence that, if there are failures(and null pointer is a failure), then even my app won’t start in incorrect state, and this approach can save a lot of deffensive code in rest of app. A Second case is invalid data provided, in POCOs, Models etc. This stuff belongs to validation which is diffrent responsibility in my opinion.

    Regards!

    Lubię

Skomentuj

Wprowadź swoje dane lub kliknij jedną z tych ikon, aby się zalogować:

Logo WordPress.com

Komentujesz korzystając z konta WordPress.com. Log Out / Zmień )

Zdjęcie z Twittera

Komentujesz korzystając z konta Twitter. Log Out / Zmień )

Facebook photo

Komentujesz korzystając z konta Facebook. Log Out / Zmień )

Google+ photo

Komentujesz korzystając z konta Google+. Log Out / Zmień )

Connecting to %s