Is it safe instantiate a strongly typed DataTable directly

J

Javier Venero

I have generated a strongly typed DataSet class with one DataTable.
Supose DataSet class name is DSCustomers and embedded DataTable class
generated by VS is CustomersDataTable.
I am not sure if it's safe to do and use this:
DSCustomers.CustomersDataTable table = new DSCustomers.CustomersDataTable();
....
or if it is more safe to do this:
DSCustomers ds = new DSCustomers();
DSCustomers.CustomersDataTable table = ds.Customers;
....
I do not need the DataSet functionality, I just need the strongly typed
DataTable class, so I am trying to bypass the DataSet inizalization, but I
do not know if this is a valid technique.
Thanks.
 
G

Gregory Persson

I'm not an expert, but the following looks good to me.

DSCustomers.CustomersDataTable table = new
DSCustomers.CustomersDataTable();

If you don't need a whole DataSet, I wouldn't instantiate one.

~Greg
 

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