M
Mountain Bikn' Guy
How would I do this?
public sealed class UtilityClass
{
public static MyObject Object1;//see note below about importance of
static object names in this class
public static MyObject Object2;
// ...
public static MyObject Object400;
public static CreateObjects()
{
for (int i = 0; i < dt.Rows.Count; ++i)
{
//create each static ObjectN field using values stored in table.
How?
}
}
}
I have an DataSet with DataTable dt. The DataSet is created by reading an
XML file. Then I need to create a bunch of static objects. The objects
fields are all hard-coded into this utility class and the names are
extremely important. I can't actually name them generically as shown. It is
very important for other code that we be able to call
UtilityClass.SpecificObjectName. I need an efficient way to use all the data
in the DataTable to create these specifically named static objects. Any
suggestions?
public sealed class UtilityClass
{
public static MyObject Object1;//see note below about importance of
static object names in this class
public static MyObject Object2;
// ...
public static MyObject Object400;
public static CreateObjects()
{
for (int i = 0; i < dt.Rows.Count; ++i)
{
//create each static ObjectN field using values stored in table.
How?
}
}
}
I have an DataSet with DataTable dt. The DataSet is created by reading an
XML file. Then I need to create a bunch of static objects. The objects
fields are all hard-coded into this utility class and the names are
extremely important. I can't actually name them generically as shown. It is
very important for other code that we be able to call
UtilityClass.SpecificObjectName. I need an efficient way to use all the data
in the DataTable to create these specifically named static objects. Any
suggestions?