I
ITnerd
In the interest of code re-use, I would like to place some code in a utility
class to be used by other classes. The problem is that this code requires
the following snippet:
for(i=0; i < tbl.Rows.Count; i++)
{
myDataRow = tbl.Rows;
company.someNestedClass sc = new company.someNestedClass();
for(j=0; j < tbl.Columns.Count; j++)
{
sc.someProperty = Convert.ToBoolean(myDataRow.ItemArray[0]);
sc.anotherProperty = Convert.ToBoolean(myDataRow.ItemArray[1]);
}
myHash.Add(someKey, sc);
}
how can I make company.someNestedClass sc = new company.someNestedClass();
into something more generic/variable/unspecific?
Also, can you cast to a cast variable of some sort, so that you don't have
to know, until runtime, what you want to cast to?
As it is, I have to put this code in every class I wish to apply it to.
Thanks in advance.
class to be used by other classes. The problem is that this code requires
the following snippet:
for(i=0; i < tbl.Rows.Count; i++)
{
myDataRow = tbl.Rows;
company.someNestedClass sc = new company.someNestedClass();
for(j=0; j < tbl.Columns.Count; j++)
{
sc.someProperty = Convert.ToBoolean(myDataRow.ItemArray[0]);
sc.anotherProperty = Convert.ToBoolean(myDataRow.ItemArray[1]);
}
myHash.Add(someKey, sc);
}
how can I make company.someNestedClass sc = new company.someNestedClass();
into something more generic/variable/unspecific?
Also, can you cast to a cast variable of some sort, so that you don't have
to know, until runtime, what you want to cast to?
As it is, I have to put this code in every class I wish to apply it to.
Thanks in advance.