© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•14mo ago•
41 replies
ElectricTortoise

Why is the struct allowed but the class isn't?

The error is CS8618 - Non-nullable variable must contain a non-null value when exiting constructor. Consider declaring it as nullable.

The struct is readonly if that matters.
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

❔ Struct vs Class
C#CC# / help
3y ago
Why `where T: class`
C#CC# / help
2y ago