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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:05:59+00:00 2026-06-02T14:05:59+00:00

difference between property with empty accessor or without accessor? // Property with empty accessors

  • 0

difference between property with empty accessor or without accessor?

// Property with empty accessors
public string Name { get; set; }

// Property without accessor
public int Counter;

edit:

what implications beyond the compiler’s statement implies such

  • 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-06-02T14:06:00+00:00Added an answer on June 2, 2026 at 2:06 pm

    Actually second one is not property it is public field.

    Properties in C# is just shortcut for two type of methods – accessors and mutator (or get and set). So, when you write some property like

    private string _name;
    
    public string Name 
    { 
       get { return _name; } 
       set { _name = value;  }
    }
    

    Compiler will actually create two methods

    public string get_Name() { return _name; }
    public void set_Name(string value) { _name = value; }
    

    When you write

    public string Name { get; set; } 
    

    then compiler will generate those two methods and generate backing storage (field _name) for you.

    When you do not use get and set, then it is simple field (like _name) and no methods will be generated by compiler.

    For your second question:
    What is the difference between a field and a property in C#

    Because property is actually a method(s), they could be abstract or virtual, could be overridden. Properties could be part of interface. Properties could be used in data binding. You can add any logic to property (e.g. raising some event, lazy-loading, or performing validation). You can define different access level for setting and getting property (e.g. private and public). This all is not true for public fields.

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

Sidebar

Related Questions

What is difference between in the following statements String name = Tiger; final String
can somebody tell me the difference between public class Vendor { public string VendorName
Possible Duplicate: Difference between Property and Field in C# public class Test { public
Edit, as per these comments: Do you mean "Property" vs "Field"? public String S1;
I see little functional difference between using a property public readonly property foo as
What's the difference between @{property} and ${property} in accessing Ant properties? Didn't see any
I like to learn the difference between Class Property and Prototype in Javascript what
What is the difference between @property(nonatomic, retain) that we used in Xcode 3.2 and
Maybe someone could explain the difference between property: in .h file @property(nonatomic,retain) NSString *someString;
Can anyone tell me the difference between [self.property release] and [property release] . I

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.