Is it safe instantiate a strongly typed DataTable directly

  • Thread starter Thread starter Javier Venero
  • Start date Start date
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.
 
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
 
Back
Top