After reading a bit about the Int32
struct in C#, I realized that int
and Int32
are synonymous. In the source code of Int32 struct, th
It's rather hard to follow what's going on when reading the source of the core framework.
"how the value gets stored in m_value when we give int i=7;
"
Firstly, when the C# compiler sees int
, it just pretends you said System.Int32
instead (*). Similarly when it sees 7
, it says "aha! That's an integer literal. I'll store it in a System.Int32
". So then it creates the variable i
(of the right type), and initializes it with the value it created.
(*) That means that the source http://referencesource.microsoft.com/#mscorlib/system/int32.cs,225942ed7b7a3252 has:
public struct Int32 : *various bases*
{
internal Int32 m_value;
... which is ever so slightly confusing (and wouldn't normally be legal).