The difference between the two access / receiver / setter methods?

What is the difference between this:

public string Title { get; set; }

and this:

public string Title;

On the same day, people always said that they used access methods with private variables called a public accessory, now that .net made get; set; so simplified that they look almost the same without a private variable, since they use only a public variable, so what's the point and difference?

+3
source share
3 answers

I have an article about this: Why properties matter .

: API. . . , (, , ) - . .

+8

public string Title { get; set; }

- ( ).

public string Title;

.

, (Encapsulation).

+2

( ), .

0

Source: https://habr.com/ru/post/1754587/


All Articles