Timeline for What is the difference between const and readonly in C#?
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 22, 2020 at 12:46 | comment | added | Suncat2000 |
@user1333 You're confusing a dereferenced value with the referenced value. The instance in your example, the read-only value, is a Char[] . The value you're changing in the first update statement is content accessed through the reference, not the reference itself.
|
|
Aug 17, 2020 at 13:03 | history | edited | d219 | CC BY-SA 4.0 |
added 3 characters in body
|
Apr 27, 2018 at 14:28 | comment | added | Mike Rosoft |
You can have const with reference types other than string, but the constant can only have the value null .
|
|
Aug 19, 2016 at 13:02 | comment | added | springy76 |
Is there any other reference type than string that you could use as a constant?
|
|
Apr 30, 2013 at 6:57 | review | Suggested edits | |||
Apr 30, 2013 at 7:03 | |||||
Sep 29, 2008 at 21:19 | history | edited | user1333 | CC BY-SA 2.5 |
deleted 89 characters in body
|
Sep 11, 2008 at 11:22 | history | edited | user1333 | CC BY-SA 2.5 |
added 44 characters in body
|
Sep 11, 2008 at 10:37 | history | answered | user1333 | CC BY-SA 2.5 |