Hi Andy,
I'm also still trying to get my head round this, so hopefully someone will
correct me is I have anything wrong...
AS far as I understand, if you do objEmployee = null
then all you are doing is destroying the pointer to the object 'objEmployee'
the actual object does not get affected. HOWEVER, assuming nothing else is
referencing the object then the CLR Garbage Collector should, at some point
realise that the object is un-referenced and will reclaim the memory.
The only problem is that if objEmployee does some 'complicated' stuff like
reference an external object, or open a database connection etc. then simply
by you removing the reference to it (objEmployee=null) the Garbage collector
may not be able to reclaim the memory.
This is where you could implement the Dispose method, which would do all the
necessary tidying up (close connections, dispose of external objects etc.)
so that the GC could neatly dispose of the unused object.
So I think depending on the circumstances you may need to use Dispose.
Though simple objects should sort themselves out. You don't normally need to
set the object to null as it may be reclaimed as soon as it goes out of
scope anyway.
Hope that makes some sort of sense...
Chris.