© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•14mo ago•
7 replies
Jacko

Properties vs constructor:

I’m currently creating a new project and have a class called Repository that gathers info about the system the code is running on and makes some api requests. If the class has several internal values like system status which is fetched from an api, should I run the code to fetch the status in the constructor or can I have a property getter so I can write repo.system_status to get the latest value without needing to call a function ?
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

❔ properties/constructor question
C#CC# / help
4y ago
`required` vs primary constructor
C#CC# / help
8mo ago
Properties vs Fields in C#
C#CC# / help
13mo ago
❔ [EF Core] Ignore properties from constructor of base class
C#CC# / help
3y ago