The refactor tool I'm using often suggests that I change something like this:
string title = "Some title.";
to
const string title = "Some title.";
Why, what is/are the difference(s)?
Thanks!
const is the prefix of a constant variable. One that doesn't change at runtime.
Usually if you have a variable that meets this you should declare it as constant (const), both to avoid mistakes in the code and to enable compiling optimizations.
This is why the refactoring tool does it for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With