Where are .Net data types stored?
All basic CTS types like Int16, Int32, Int64, String, Byte, etc. are defined in MSCorLib.dll. This file can be found in the C: \ Windows \ Microsoft.NET \ Framework \ v2.0.50727 directory.
All other types and special-purpose classes are stored in their respective assemblies FCL [Framework Class Library]. Like all types related to Windows Forms development can be found in System.Windows.Form..dll, and all types related to web / asp.net development are defined in System.Web..dll. You can find these and related assemblies in the local machine GAC.
a source to share
If you mean "where in memory the data is stored - on the stack or on the heap", it gets pretty complex and is somewhat language dependent.
I wrote an article on this that goes in more detail than I would like to repeat here. Simplified explanations such as the often-repeated "value types on the stack, reference types on the heap" are grossly flawed, with the obvious counterexample of a variable int
in a reference type - the value of that variable will always be stored on the heap, although it int
is a value type.
However, you would also be wise to read Eric Lippert 's blog post on this issue - this is an implementation issue and developers tend to worry too much about it. The C # team decided to change all of this in a later version and create a new object containing all local variables (not just captured ones).
Admittedly, an important implementation detail is how you push onto the stack affects how deep your stack can be, etc. - but we should probably spend so much time obsessed with it.
If this is not the question you mentioned, please clarify it. For example, you might understand:
- Where does the type's metadata exist at runtime?
- Where are BCL types stored on disk?
- Where is JIT-compiled code for types stored and is it stored?
a source to share