Re: " //Clean Up managed resources " f&*ck
- From: "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 18 May 2007 15:03:38 -0400
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
"Koliber (js)" <profesor_kinbote@xxxxxxxxxxxxxx> wrote in message
news:1179506637.986623.183020@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
sorry for my not perfect english
i am really f&*ckin angry
in this common pattern about dispose:
//////////////////////////////////////////////////////////
Public class MyClass:IDisposable
{
private bool IsDisposed=false;
public void Dispose()
{
Dispose(true);
GC.SupressFinalize(this);
}
protected void Dispose(bool Diposing)
{
if(!IsDisposed)
{
if(Disposing)
{
//Clean Up managed resources
}
//Clean up unmanaged resources
}
IsDisposed=true;
}
~MyClass()
{
Dispose(false);
}
}
////////////////////////////
most of things are clear -
there are two ways of calling dispose - one from finalizer (only
unmanaged managed will free automatically
if i do understand) second by Dispose() (managed and unamanaged by
hand) BUT
what the hell " //Clean Up managed resources " mean
pozdrawiam (greetings)
C Kinbote
.
- 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)
- " //Clean Up managed resources " f&*ck
- Prev by Date: Re: Is there a way around the string length limitation for the BalloonTipText under a NotifyIcon component?
- Next by Date: Re: creating a custom listview item
- Previous by thread: " //Clean Up managed resources " f&*ck
- Next by thread: Re: " //Clean Up managed resources " f&*ck
- Index(es):
Relevant Pages
|