Monday, March 12, 2012

how to Copy/Clone a derived DataTable

I would like to add a few properties and methods to an ADO.NET DataTable. So
the normal thing would be to derive a class:
Public Class MyTable
Inherits DataTable
Private This As That
Private TheOtherThing As Whatever
Now, a DataTable has Clone and Copy methods. Is there a straight forward way
for my Derived class to implement Clone and Copy, and rely on the base class
to copy the schema and data? Or do I have to do the heavy lifting myself?
I mean, I can create Clone and Copy functions in the derived MyTable class,
mark them as Shadows to have them replace or override these functions in the
base class, but is there any easy way to copy the schema and data?
ThanksIf it's 2.0, then Serialize and Deserialize your derived DataTable.
- Sahil Malik [MVP]
ADO.NET 2.0 book -
http://codebetter.com/blogs/sahil.malik/archive/2005/05/13/63199.aspx
----
"Mark" <mark.bax@.blaisesoft-xxx.com> wrote in message
news:%235wOqEfSGHA.1204@.TK2MSFTNGP12.phx.gbl...
>I would like to add a few properties and methods to an ADO.NET DataTable.
>So the normal thing would be to derive a class:
> Public Class MyTable
> Inherits DataTable
> Private This As That
> Private TheOtherThing As Whatever
> Now, a DataTable has Clone and Copy methods. Is there a straight forward
> way for my Derived class to implement Clone and Copy, and rely on the base
> class to copy the schema and data? Or do I have to do the heavy lifting
> myself?
> I mean, I can create Clone and Copy functions in the derived MyTable
> class, mark them as Shadows to have them replace or override these
> functions in the base class, but is there any easy way to copy the schema
> and data?
> Thanks
>

Labels: , , , , , , , , , , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home