Re: " //Clean Up managed resources " f&*ck
- From: Moty Michaely <Moty.Mi@xxxxxxxxx>
- Date: 18 May 2007 13:58:17 -0700
On May 18, 11:24 pm, "Koliber (js)" <profesor_kinb...@xxxxxxxxxxxxxx>
wrote:
On 18 Maj, 21:03, "Nicholas Paldino [.NET/C# MVP]"<m...@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Koliber,
What this means is that if you the disposing parameter of the Dispose
method is true, then you want to call Dispose on any reference that you have
which implements IDisposable. Say your class had a SqlConnection that it
was holding onto. If the disposing parameter was true, then you would call
Dispose on the connection, otherwise, you would not.
No no no no
Net says to me that SqlConnection is unmanaged resource (resource I
should manage) - you say that
it is managed resource? If so what is unamanaged resource?
K.
K,
Unmanaged code is such code that is not managed by the CLR.
Handles to files, windows etc. that obtained using unmanaged code
(e.g. by P/Invoke).
SqlConnection uses various of unmanaged code for it's implementation
of the underlying physical connection for example (socket connections,
named pipes etc..)
These kine of unmanaged resources are expensive so developers should
use the Dispose pattern to give the option of cleaning unmanaged
resources that are not in use in a deterministic way. Although it is
not necessary, it is very advisable to clean resources in a
deterministic way since GC is not deterministic.
Cheers,
Moty
.
- Follow-Ups:
- Re: " //Clean Up managed resources " f&*ck
- From: Koliber (js)
- Re: " //Clean Up managed resources " f&*ck
- References:
- " //Clean Up managed resources " f&*ck
- From: Koliber (js)
- Re: " //Clean Up managed resources " f&*ck
- From: Nicholas Paldino [.NET/C# MVP]
- Re: " //Clean Up managed resources " f&*ck
- From: Koliber (js)
- " //Clean Up managed resources " f&*ck
- Prev by Date: Re: Help with Generic Method
- Next by Date: Re: Help with Generic Method
- Previous by thread: Re: Clean up resources
- Next by thread: Re: " //Clean Up managed resources " f&*ck
- Index(es):
Relevant Pages
|