c# (Csharp) and .NET :- const vs readonly c# | what is const | what is readonly

Published: 16 April 2021
on channel: ALLCPL
659
15

Difference between Const and ReadOnly in C# | const vs readonly c# | what is const | what is readonly

const keyword :
A variable declared as const must be assigned a value at declaration.
And we can not change its value once it is assigned.
They are implicitly static by default.
You can apply const keyword to built-in value types (byte, short, int, long, char, float, double, decimal, bool), enum, a string literal, or a reference type which can be assigned with a value null.

readonly keyword:
The value will be initialized either at declaration time or in the constructor.

Read only values will evaluate at runtime only.

#readonly #const #allcpl


Watch video c# (Csharp) and .NET :- const vs readonly c# | what is const | what is readonly online without registration, duration hours minute second in high quality. This video was added by user ALLCPL 16 April 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 659 once and liked it 15 people.