JonnyPoet
October 2nd, 2009, 04:19 PM
Hi Friends!
I have some very basic, but a bit theoretical question.
How is a string in C# stored in the memory. I know it is an immutable Reference Type. OK. But the chars for the immuteable string needs to be stored anywhere in the storage, where the reference points too. How does the compiler know where the string ends. Is it terminated with '\0' or is it as I have read an ANSI string and the length of the string is stored in an integer.
In another place of the web I have read that all strings in .net (and C# is a .net language) are automatically UTF8 Format ( Unicode) which would mean that the word 'Hallo' needs 10 Bytes in the memory.
So whats behind that, or where can I find references about that.
The reason is: I simple want t get a deeper understanding of whats going on behind the scene.
Thx in before
I have some very basic, but a bit theoretical question.
How is a string in C# stored in the memory. I know it is an immutable Reference Type. OK. But the chars for the immuteable string needs to be stored anywhere in the storage, where the reference points too. How does the compiler know where the string ends. Is it terminated with '\0' or is it as I have read an ANSI string and the length of the string is stored in an integer.
In another place of the web I have read that all strings in .net (and C# is a .net language) are automatically UTF8 Format ( Unicode) which would mean that the word 'Hallo' needs 10 Bytes in the memory.
So whats behind that, or where can I find references about that.
The reason is: I simple want t get a deeper understanding of whats going on behind the scene.
Thx in before