© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
10 replies
Ninshu

❔ Field / Property Initialized By Method

Hello, I could have sworn I read somewhere in the .NET API's that there was an attribute you could use to tell the compiler that a property was initialized by a certain method.

If anyone knows the name of the attribute I would be eternally greatful. I am creating a blazor wasm application. It is annoying to have to keep setting my component properties to { get; set; } = null! when they are being set by
OnInitialized
OnInitialized
or
OnInitializedAsync
OnInitializedAsync
.
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

Connection property has not been initialized
C#CC# / help
2y ago
✅ Field is not initialized by the source generator: System.NullReferenceException
C#CC# / help
8mo ago
❔ A field initializer cannot reference the nonstatic field, method, or property
C#CC# / help
4y ago
❔ Property vs field?
C#CC# / help
3y ago