Value of reference type before "new" keyword
I would like to clarify following. I know that reference type variable contains reference to block of memory which can contain value of that type. But before that value is assigne开发者_运维问答d by using "new" keyword, the reference just points to empty place in memory?
Unassigned fields are null
references.
You can think of a null
reference as pointing to nowhere.
It's a null for reference types, and default(type) for value types.
However, the compiler will prevent you from using unassigned fields and variables.
精彩评论