mojeza <na****@hotmail.comwrote in news:1178139077.955623.103050
@e65g2000hsc.googlegroups.com:
What I like to accomplish is to create a generic class which could be
use to accomodate data pull from any DataTable with various column
numbers. In another words, when DataTable is populated I would like to
enumarate a column collection and create as many items in my generic
class as there are column in DataTable. Can this be done?
You can already enumerate the a datarow object (Columns is a collection).
If you like to create something generic, you'll need to store each piece of
data as a element in a collection, i.e.:
MyObjectStore("Column1").Value = DataRow("Column1")
MyObjectStore("Column2").Value = DataRow("Column2")
etc.
Otherwise if you like to create a truly dynamic type... I believe you can
do this with reflection. However, I don't believe web services can handle
that sort of object ... since you need the WSDL defintion beforehand.