M
M
Maxim2021-10-17 19:01:17
C++ / C#
Maxim, 2021-10-17 19:01:17

Is it possible to make a call to a protection variable private via get; set?

Good evening, the question arose whether it is possible to call a private protection variable in this way? Or is the call only possible with public protection?
private string name { get; set; }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Lenchenkov, 2021-10-18
@MaximPython

if you need to limit the record, then it's better like this:
public string Name { get; private set; }

V
Vladimir Korotenko, 2021-10-17
@firedragon

You can do a lot with reflection. but why?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question