Stupid me, what's the ~ before constructor method for?
and why do you have to reset m_DataRow
back to null, will accessing  m_DataRow after the delete cause an
exception? I'm still learning.

On Fri, 26 Apr 2002 10:09:56 +0200, MSTSE Developer
<[EMAIL PROTECTED]> wrote:

>i'm having a problem with destroying datarow objects. The methode
>DataTable.NewRow() returns an empty row for the table but does not
>insert the row into the table. when the row is member of the table there
>is no problem at deleting the row but my problem is to destroy the row
>without inserting it into the table. is the row maybe part of another
>collection in the table than the "Rows" collection which prevent that
>the garbage collector is collecting the row.
>
>        public class RowSample
>        {
>                DataRow m_DataRow =  null;
>
>                public RowSample(DataTable dt)
>                {
>                        m_DataRow = dt.NewRow();
>
>                        // without these line there is a memory leak
>                        dt.Rows.Add(m_DataRow);
>                }
>
>                ~RowSample()
>                {
>                        m_DataRow.Delete();
>
>                        m_DataRow = null;
>                }
>        }
>
>You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
>subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to