DataRows & other objects

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,

First off, please forgive me for posting to this group. My question is about ADO .NET, and I couldn't find another group that focused on ADO .NET. I did see one for classic ADO, but wasn't sure if this was the best group for my question.

I've been playing around with ADO .NET for about a month now, and like what I see. However, whenever a declare some of the objects in code (ie, DataSets, DataAdapters), I always have to place the "New" keyword in my declaration statement. Whenever I declare DataRows and DataColumns, I've discovered that the "New" keyword is not required.

My question is this. Why is the "New" keyword required for some ADO .NET objects and not others. Thanks in advance.

Best Regards,
David Morris
 
Hi David,

The reason is because the constructors for datarows are declared protected
(which pretty much only allows them to be created by inherited objects,
those inheriting from datarow).

Reason? A datarow itself has no columns defined and belongs to no table, so
it doesn't really serve much purpose. By using a protected constructor, it
forces the developer to inherit from it to create a new datarow that is
properly typed and belongs to a proper table.

Hi All,

First off, please forgive me for posting to this group. My question is
about ADO .NET, and I couldn't find another group that focused on ADO .NET.
I did see one for classic ADO, but wasn't sure if this was the best group
for my question.
I've been playing around with ADO .NET for about a month now, and like
what I see. However, whenever a declare some of the objects in code (ie,
DataSets, DataAdapters), I always have to place the "New" keyword in my
declaration statement. Whenever I declare DataRows and DataColumns, I've
discovered that the "New" keyword is not required.
My question is this. Why is the "New" keyword required for some ADO .NET
objects and not others. Thanks in advance.
 
Back
Top