In C#, you can define a const string
, but not an array as arrays are objects
. It is to my understanding that strings are in fact object
s as they are reference objects passed by value just like arrays.
So how is it that we can do this:
const string NewLine = "\r\n";
but not this:
const byte[] AesSwapBytes = new byte[] { ... };
Is it because we can't change individual characters on strings (NewLine[0] = '\n'
), but can on arrays (arr[0] = i
)?