C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

Difference between Fields and Properties


Posted Date: 07 Nov 2009      Posted By: jack      Member Level: Gold     Points: 1   Responses: 2



Hi All,

Can any one tell what is the difference between Fields and Properties.

Please provide a good example for better understanding

please provide code also if possible with explaination.

Thanks in Advance





Responses

Author: vipul    07 Nov 2009Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

Hi,
for that you can refer this link they provide good article on your question
http://stackoverflow.com/questions/295104/what-is-the-difference-between-a-field-and-a-property-in-c

Please Rate This Answer If They Helpful

Thanks & Regards
Patel Vipul



Author: ABitSmart    07 Nov 2009Member Level: DiamondRating: 3 out of 53 out of 53 out of 5     Points: 3

Basically, Property is a wrapper over a Field. Field is the basic memory storage of an object while Property is a way to access fields. Good code standards outline fields to be kept private and accessed from a property.
e.g.

private string _field; //this is a field

//this is property to the field
public string PropertyField {
get {
return _field;
}
set {
_field = value;
}


Kind regards,
ABitSmart
DNS Web-master, DNS MVM
My blog
Thoughts.exe



Post Reply
You must Sign In to post a response.
Next : Controls in the Template column in my datagrid is lost when i use paging
Previous : How to select
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use