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 1006953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:32:38+00:00 2026-05-16T08:32:38+00:00

Possible Duplicate: Public Data members vs Getters, Setters In what cases should public fields

  • 0

Possible Duplicate:
Public Data members vs Getters, Setters

In what cases should public fields be used, instead of properties or getter and setter methods (where there is no support for properties)? Where exactly is their use recommended, and why, or, if it is not, why are they still allowed as a language feature? After all, they break the Object-Oriented principle of encapsulation where getters and setters are allowed and encouraged.

  • 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. Editorial Team
    Editorial Team
    2026-05-16T08:32:39+00:00Added an answer on May 16, 2026 at 8:32 am

    That’s hard to tell, but in my opinion public fields are only valid when using structs.

    struct Simple
    {
        public int Position;
        public bool Exists;
        public double LastValue;
    };
    

    But different people have different thoughts about:

    http://kristofverbiest.blogspot.com/2007/02/public-fields-and-properties-are-not.html

    http://blogs.msdn.com/b/ericgu/archive/2007/02/01/properties-vs-public-fields-redux.aspx

    http://www.markhneedham.com/blog/2009/02/04/c-public-fields-vs-automatic-properties/

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

Sidebar

Related Questions

Possible Duplicates: Public Data members vs Getters, Setters Purpose of private members in a
Possible Duplicates: Should I use public properties and private fields or public fields for
Possible Duplicate: Comparing object properties in c# Let's say I have a POCO: public
Possible Duplicate: When to use virtual destructors? If all the data members of a
Possible Duplicate: What are access specifiers? Should I inherit with private, protected or public?
Possible Duplicate: Member initialization of a data structure’s members EDIT: I typed the title
Possible Duplicate: Why not use tables for layout in HTML? Under what conditions should
Possible Duplicate: Accessing private members Is it possible to access private members of a
Possible Duplicate: Data transfer from JavaScript to PHP. How can i get the browser's
Possible Duplicate: Understanding Threads I have a public class that is implementing a Runnable

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.