© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
15 replies
GNUGradyn

❔ Appease "Property is uninitialized" without setting a default value? Possibly make it required?

Hello, I am trying to go through my code and fix all the warnings to improve code quality. I have this string property that must be set when this class is instantiated. It does not have a default value because it must be set every time when you create an instance of this class. Because of this I get this warning. Is there an annotation or something to tell the compiler "this property is required, and so this class cannot be instantiated without it" to appease the warning?
image.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Setting a Default Value for Migrations
C#CC# / help
16mo ago
✅ Required property
C#CC# / help
2y ago
EF Entity 'required' property
C#CC# / help
2y ago
❔ EF Core setting property with value converter to null
C#CC# / help
3y ago