Designing .NET Class Libraries: Designing for a Managed Memory WorldDesigning .NET Class Libraries is very good place that I am used to go here and study something anout .NET Framework. I also like Brad Abrams very much, because hi usually use very simple example to explain such hard thing like “dispose”, “finalizer”, “Manage code”, “CLR” … . In the speechDesigning for a Managed Memory WorldBrad Abrams focus on “Gabage Colloection”, and talking about finalizer (seems he like this word more than destructor) , dispose( I think dispose is new concept in .NET framework, but it really hard to use it well).

He also talk about try {} ,excption{} and_ finally {}_ to manage the memory well. Nested use try{} finally {} can make exception more clear and can handle more condition even we don’t think it will happen.

static void CopyFile(file sourcdeFile, file destFile){ > > try { > >     OpensourceFile(sourcdeFile); > >    try { OpensourceFile(destFile);  } > >    finally { CloseFile(destFile); } > >    } > >  finally { CloseFile(sourcdeFile); } > > } > >

Important concept about GC (Gabage Collection) is when dispose, close, finalize call? The anwser is use code to call dispose and close; but GC will call finalize when this object should be collection back.

Buy Me A Coffee


Attitude is everything