Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SUGGEST:Should add 'argument cannot be null' feature in C# #16435

Closed
ah-its-andy opened this issue Jan 11, 2017 · 2 comments
Closed

SUGGEST:Should add 'argument cannot be null' feature in C# #16435

ah-its-andy opened this issue Jan 11, 2017 · 2 comments

Comments

@ah-its-andy
Copy link

Just like:
void Sample(object objCanNotBeNull != null)
On developing , IDE should warn 'Sample(null)'.
On runtime , application should throw a exception.

In most cases,we don't want the function arguments to be null,then we must write 'if(obj==null) throw new exception'.It's boring and absolutely no need.Can we add this feature in new C#?

@orthoxerox
Copy link
Contributor

https://github.com/dotnet/roslyn/issues?q=is%3Aissue+is%3Aopen+label%3A%22New+Language+Feature+-+Nullable+Reference+Types%22 esp #5032

@jcouv
Copy link
Member

jcouv commented Oct 22, 2017

See Mads's recent overview of "non-nullable reference types" being prototyped for C# 8.0. Stay tuned for updates.
I'll go ahead and close this issue. Thanks

@jcouv jcouv closed this as completed Oct 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants