Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 160749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:05:25+00:00 2026-05-11T11:05:25+00:00

I realize that it seems to be a duplicate of What is the difference

  • 0

I realize that it seems to be a duplicate of What is the difference between a Field and a Property in C#? but my question has a slight difference (from my point of view):

Once I know that

  • I will not use my class with ‘techniques that only works on properties’ and
  • I will not use validation code in the getter/setter.

Is there any difference (except the style/future development ones), like some type of control in setting the property?

Is there any additional difference between:

public string MyString { get; set; } 

and

public string myString; 

(I am aware that, that the first version requires C# 3.0 or above and that the compiler does create the private fields.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T11:05:26+00:00Added an answer on May 11, 2026 at 11:05 am

    Encapsulation.

    In the second instance you’ve just defined a variable, in the first, there is a getter / setter around the variable. So if you decide you want to validate the variable at a later date – it will be a lot easier.

    Plus they show up differently in Intellisense 🙂

    Edit: Update for OPs updated question – if you want to ignore the other suggestions here, the other reason is that it’s simply not good OO design. And if you don’t have a very good reason for doing it, always choose a property over a public variable / field.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I realize that a SO user has formerly asked this question but it was
I realize that this question has been asked 100times but none that I have
I realize that this question may appear to be a duplicate, but none of
Greets. I realize this might be seen as a duplicate question as this but
I realize that the answer to this question is likely quite obvious (if somewhat
(I realize that my title is poor. If after reading the question you have
So I realize this is a possible duplicate question, as there a number of
I'm starting a new JSF (2) project. I realize that pure JSF has some
Possible Duplicate: pre Decrement vs. post Decrement What is the difference between ++i and
I'm sure this question has been asked and answered before, but my Google-fu is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.