Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Whats the difference between const and readonly?

const difference readonly
0
Posted

Whats the difference between const and readonly?

0

You can initialize readonly variables to some runtime values. Let’s say your program uses current date and time as one of the values that won’t change. This way you declare public readonly string DateT = new DateTime().ToString().

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.