c# - Prop and field? -


this question has answer here:

what difference between field , property in c#?

i have read through topic above full of confusing answers blah blah.

i want know, in plain english, code below field or property? . if it's field, property? if it's property, field?

class door {      public int width { get; set; } } 

thank much.

a property syntax defining getters , setters field.

class door {      public int width { get; set; } } 

is similar to

class door {     private int width;      public int getwidth()     {         return width;     }     public void setwidth(int i)     {         width = i;     } } 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -