We help IT Professionals succeed at work.
Get Started

Can I add an object directly to a Data Row?

guxiyou
guxiyou asked
on
745 Views
Last Modified: 2010-04-21
Ok, this is probably an easy question, but here goes.  When you add to the DataRowCollection of a DataTable, it says that there are two overloads:
1) DataRowCollection.Add(params object [] values)
2) DataRowCollection.Add(DataRow row)

So my question is this, if I've declared the DataTable to be a table consisting of a single row, say "ID", then can I add the single value as just  DataRowCollection.Add(value), assuming that value is of type object? Since value is of type object, not of type object [], is this still correct (standard)? I have written a program that demonstrates that this works, but I need to know whether this is standard.  So, I'll award points to the first person to explain how this behavior is/is not standard (this would include references to the standard or other credible sources).

Thanks!
Comment
Watch Question
Top Expert 2009
Commented:
This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE