IL_0007: ldnull
IL_0008: stloc.0
IL_0009: ret
} // end of method Program::MakeACar
What you must understand, however, is that assigning a reference to null does not in any way
force the garbage collector to fire up at that exact moment and remove the object from the heap.
The only thing you have accomplished is explicitly clipping the connection between the reference
and the object it previously pointed to. Given this point, setting references to null under C# is far
less consequential than doing so in other C-based languages (or VB 6.0); however, doing so will cer-
tainly not cause any harm.
Do'stlaringiz bilan baham: |