C#8 Nullable References
See original GitHub issueHi! Your article was very nice, ty for that. We’re using the new feature from c# to annotate nullable reference types with poco classes. Since the new feature requires properties to be initialized if not mentioned in a constructor we came up with this pattern:
public class ModelPoco
{
public User CurrentUser { get; set; } = default!;
}
This way the adaption on legacy code is quite simple by just appending ` = default!;" to each property.
Could your extension help to avoid this additional code?
Best, Bernhard
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Essential .NET - C# 8.0 and Nullable Reference Types
There's an inconsistency between reference types and value types (following the introduction of Nullable<T>) in that value types are nullable when decorated ...
Read more >Null reference types - proposal - C# 8.0 draft feature ...
Null guard guidance As a feature, nullable reference types allow developers to express their intent, and provide warnings through flow analysis ...
Read more >Nullable reference types in C# 8.0
Nullable reference types are a new feature in C# 8.0. They allow you to spot places where you're unintentionally dereferencing a null value ......
Read more >What are nullable reference types in C# 8.0?
Reference types are objects that are stored on the heap. When an object has not been assigned to a reference type, the value...
Read more >Using C# 8 and Nullable Reference Types in .NET Framework
Globally enabling nullable reference types can only be done with the new project format. Nullability can be changed on a per-file or per-line ......
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 FreeTop 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
Top GitHub Comments
For anyone trying out this library with VS Code:
DiagnosticSuppressor
is not yet supported by OmniSharp (https://github.com/OmniSharp/omnisharp-roslyn/issues/1711) so the Problems panel will still show the warnings.@SeriousM I’ve just released version
2.1.31
with the requested feature. Please let me know if it works as expected.