Suggestion: Following nullable reference types
See original GitHub issueI’ve come to realize that I’m now basically putting [NotNull]
everywhere.
Maybe you’ve heard about the proposal for nullable reference types that will make unqualified reference types be non-nullable by default. (champion)
Not sure how likely that is to make it, but it’s one of the more popular proposals.
I think for NSwag, it makes sense to have a mode where the [NotNull]
is implicit on everything: Properties, return values and parameters - and then have another attribute [Null]
or [CanBeNull]
.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Nullable Reference types in C# – Best practices
In this tutorial, I look at the state of the Nullable Reference Types feature in C#, one year after its initial release.
Read more >The annotation for nullable reference types should only be ...
I have a console app to try out the C# 8 null reference types. Switched the project to build with lang ver C#...
Read more >Nullable reference types
Nullable reference types refers to a group of features enabled in a nullable aware context that minimize the likelihood that your code causes ......
Read more >Proposal: Nullable reference types and nullability checking ...
Nullable reference types are helpful, in that they help find code that may dereference null and help guard it with null checks. Making...
Read more >Strategies for Implementing Nullable Reference Types in .NET
Nullable reference types offer a way to explicitly declare whether a reference type can be null. In C#, this feature is compile-time only....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The attributes are also defined in https://www.nuget.org/packages/ReSharper.Annotations/
The attributes in NJS are also allowed for the return type, eg.:
CanBeNullAttribute, but its not yet in NJsonSchema.Annotations (you have to implement it yourself). Ill add it just now…