When I started my C# Wishlist series, one wish, though never published, was to introduce non-nullable reference types in C#.
Everybody who has written the lines
public class C
public C (T somearg)
if (somearg == null)
throw new NullArgumentException("somearg");
several thousand times would appreciate this language feature. (as Yann’s comment on a Jon Skeet blog post illustrates)
Now, a couple of years later, Eric Lippert read my mind, and answers why the (consistent!) implementation of this feature is not as trivial as it sounds.
Workaround for the time being: Code Contracts (.Net 4 and above) or external libraries such as CuttingEdge.Conditions.
This entry was posted on Friday, January 17th, 2014 at 13:39 and is filed under C#, Wishlist. You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
Fill in your details below or click an icon to log in:
You are commenting using your WordPress.com account. ( Log Out / Change )
You are commenting using your Twitter account. ( Log Out / Change )
You are commenting using your Facebook account. ( Log Out / Change )
You are commenting using your Google+ account. ( Log Out / Change )
Connecting to %s
Notify me of new comments via email.
Notify me of new posts via email.
Blog at WordPress.com.