M
M
Max Suprunenko2015-11-02 22:05:10
C++ / C#
Max Suprunenko, 2015-11-02 22:05:10

Which is better to write property?

What is the correct way to write property? Completely private or short?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Makarov, 2015-11-02
@msuprunenko

If the property one-to-one corresponds to the storage field, then it can be short, just remember to set the access correctly (it can be done separately for get and set). If several properties are taken from one field at once, then you have no choice).
It is also convenient to use a private field if the property has lazy initialization.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question