Subclassing the DataRowCollection

P

Paul Bowman

Hi All

I have a question regarding the DataRowCollection.

I need to insert rows into a DataRowCollection (using the
DataTable.Rows.Add) method but I dont want to pass any values to the
collection as they will be added by an object contained in a DataRow
object that I have inherited from DataRow. The DataRowCollection.Add
method requires either an Object array or an existing DataRow. What I
want to do is add a new Add method that will take no parameters e.g.
Add().

If I inherit from DataRowCollection when I compile the class I get an
error stating that No constructor for DataRowCollection takes 0
arguments. I am guessing that the constructor is protected or
internal.

Does anybody have any ideas how I may progress on this?

TIA

Paul Bowman
 
M

Miha Markic

Paul Bowman said:
Hi All

I have a question regarding the DataRowCollection.

I need to insert rows into a DataRowCollection (using the
DataTable.Rows.Add) method but I dont want to pass any values to the
collection as they will be added by an object contained in a DataRow
object that I have inherited from DataRow. The DataRowCollection.Add
method requires either an Object array or an existing DataRow. What I
want to do is add a new Add method that will take no parameters e.g.
Add().

If I inherit from DataRowCollection when I compile the class I get an
error stating that No constructor for DataRowCollection takes 0
arguments. I am guessing that the constructor is protected or
internal.

It is internal. That makes it impossible for inherit from. But you might
create a wrapper.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top