+ 3

What is the difference between the 'const' and 'readonly' keywords?

6th Apr 2018, 1:52 PM
Bezaleel Olakunori
Bezaleel Olakunori - avatar
2 Antworten
+ 1
You can reaad about it here: https://www.c-sharpcorner.com/UploadFile/2072a9/constant-vs-readonly-vs-static-keywords-in-C-Sharp/ But to quickly and roughly summarise; a const variable needs to be assigned at compile time when it is declared, whilst a readonly variable can have a value assigned to it when it is declared or in the constructor of the same class. There are other differences as well and can be found in the linked article
16th May 2018, 10:11 AM
William