Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

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.
Comment

PREVIOUS NEXT
Code Example
Csharp :: serialize object to json 
Csharp :: change physics material unity 
Csharp :: c# template strings 
Csharp :: c# switch example 
Csharp :: generic interface c# 
Csharp :: how to add arrays in c# 
Csharp :: Default property value in C# 
Csharp :: excel rows count 
Csharp :: animation not playing unity 
Csharp :: truncate c# 
Csharp :: action delegate c# 
Csharp :: register all services microsoft .net core dependency injection container 
Csharp :: c# sequential struct with fixed array size 
Csharp :: logical operators in c# 
Csharp :: c# int to short 
Csharp :: set time on audio source unity 
Csharp :: 1180 beecrowd URI 
Csharp :: C# Datagridview Column Header Double Click 
Csharp :: Code snipet for jump script unity 2d 
Csharp :: c# fieldnullexception 
Csharp :: how to turn the textbox into char in windows forms 
Csharp :: c# wpf control to windw size 
Csharp :: Bitwise Left Shift C# 
Csharp :: how to fill dictionary in c# 
Csharp :: get 24 hour time in c# 
Csharp :: writeline in C# 
Csharp :: finding holydays asp.net 
Csharp :: c# language 
Csharp :: Expression And Filter 
Csharp :: c# Jarray tryparse 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =