To become better at .NET I found it helpful to look into the .Net-Framework itself and how Microsoft implements all the nice things. The last time I used my decompiler to have a look at the implementation of System.String-Class
, to research how a String-Object stores its actual string. I was surprised about the largest of the class in self and that I can't clearly identify which part of the class the actual string saves.
Here are two screenshot of the decompiling which shows the start and the end part of the class:
I suppose that [System.Reflection.DefaultMember("Chars")]
(first line in first screenshot) and/or the property public extern char this[int index]
(middle of second screenshot) the what I am looking for.
Is that the correct and if yes how does it work?