Answers for "why to make private fields readonly in c#"

C#
0

why to make private fields readonly in c#

f it's private and readonly , the benefit is that you can't inadvertently change it from another part of that class after it is initialized. The readonly modifier ensures the field can only be given a value during its initialization or in its class constructor.
Posted by: Guest on March-04-2021

C# Answers by Framework

Browse Popular Code Answers by Language