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#?
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
Most helpful comment
https://github.com/dotnet/roslyn/issues?q=is%3Aissue+is%3Aopen+label%3A%22New+Language+Feature+-+Nullable+Reference+Types%22 esp #5032