Inherit from DataRow

R

Redivivus

Hi

How to inherit from System.Data.DataRow?

class ItemRow: DataRow
{
public ItemRow(DataRowBuilder rb):base(rb){}
}


Whats wrong with this code?

Best Regards;
Mex
 
R

Redivivus

Ok, but how can i inherit then from datarow?


Mex

Nicholas Paldino said:
Mex,

You are trying to call a constructor which is marked internal. Since
your code doesn't reside in the System.Data.dll assembly, the constructor
isn't available to you.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Redivivus said:
Hi

How to inherit from System.Data.DataRow?

class ItemRow: DataRow
{
public ItemRow(DataRowBuilder rb):base(rb){}
}


Whats wrong with this code?

Best Regards;
Mex
 
N

Nicholas Paldino [.NET/C# MVP]

Mex,

You are trying to call a constructor which is marked internal. Since
your code doesn't reside in the System.Data.dll assembly, the constructor
isn't available to you.
 
N

Nicholas Paldino [.NET/C# MVP]

Redivivus,

Well, you would have to declare your constructor as internal, private,
or protected. Then, you can call the base constructor, passing along the
DataRowBuilder, if you have one available to you.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Redivivus said:
Ok, but how can i inherit then from datarow?


Mex

Nicholas Paldino said:
Mex,

You are trying to call a constructor which is marked internal. Since
your code doesn't reside in the System.Data.dll assembly, the constructor
isn't available to you.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Redivivus said:
Hi

How to inherit from System.Data.DataRow?

class ItemRow: DataRow
{
public ItemRow(DataRowBuilder rb):base(rb){}
}


Whats wrong with this code?

Best Regards;
Mex
 
N

Nicholas Paldino [.NET/C# MVP]

Oh, and I should note that the constructor is available to you, just in
calling it, you can't elevate the accessibility.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Redivivus said:
Ok, but how can i inherit then from datarow?


Mex

Nicholas Paldino said:
Mex,

You are trying to call a constructor which is marked internal. Since
your code doesn't reside in the System.Data.dll assembly, the constructor
isn't available to you.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Redivivus said:
Hi

How to inherit from System.Data.DataRow?

class ItemRow: DataRow
{
public ItemRow(DataRowBuilder rb):base(rb){}
}


Whats wrong with this code?

Best Regards;
Mex
 
L

Larry Smith

Ok, but how can i inherit then from datarow?

Consider this alternative. Create a strongly-typed dataset, add your tables
and then have a look at the "YourDataSet.Designer.cs" file. You'll see a
"DataRow" derivative for each table you created as well as a "DataTable"
derivative. Each class has some useful functions noting that the "DataRow"
derivatives in particular have a property wrapping each field (column) in
your tables (very clean to use in code). These are "partial" classes and you
can easily extend them with your own partial class.
 

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