Avatar of guxiyou

asked on 

Can I add an object directly to a Data Row?

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).


Avatar of undefined
Last Comment

8/22/2022 - Mon