I get some informations in a Dataset, and i would like to cast it in a strongly type object.
For example my dataset have :
TableName : tab_data
Rows : 1
Columns : Name, FirstName, Address
So i created a class like :
public class Customer
{
public String Name;
public String FirstName;
public String Address;
}
Is there a magic trick to simply cast my dataset to Customer type ? Use LiNQ ?
Thanks,
You can’t cast this, but you can translate the data…
The answer is probably different for 1 table than it is for 20; on an individual bases, you should just be able to
Selectout the data (or alternatively, just iterate) – this will be the fastest option, but is lots of maintenance if you have lots of tables. In the latter case, some kind of reflection, perhaps like so.