© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Search
Star
Feedback
Setup for Free
C
C#
•
4y ago
•
12 replies
Hugh
Difference between using { get; set; } and not
I
'm pretty new to C
#
(experienced in C
+
+ and Python
)
, and I was wondering if someone could clarify the following for me
:
What is the difference between these two lines
:
public string MyValue;
public string MyValue;
public string MyValue { get; set; }
public string MyValue { get; set; }
I understand when you might want to define a getter and setter
, but I
've seen the second line above a lot
, and I don
't understand the difference
.
C#
Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Recent Announcements
Similar Threads
❔ Difference between using readonly or { get; }?
C
C# / help
3y ago
Difference between variable using and statement using?
C
C# / help
4y ago
Difference between string and string?
C
C# / help
8mo ago