Subclassing the DataRowCollection

  • Thread starter Thread starter Paul Bowman
  • Start date Start date
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
 
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.
 
Back
Top