How can a DataTable create a new instance of a DataRow with the NewRow method if the constructor of the DataRow class is protected internal and DataTable doesn't inherit from DataRow?
Example:
class Program
{
static void Main()
{
// error: inaccessible due to its protection level
DataRow dr = new DataRow();
// works
DataRow dr = new DataTable().NewRow();
}
}
protected internal means "accessible by derived classes" and "accessible by other classes in the same assembly". DataTable and DataRow are in the same assembly, so DataTable has access to all of DataRow's internal members.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With