G
Guest
Casting from a DataSet to a typed DataSet seems to work, as in the example
below. This seems counterintuitive to me - isn't it attempting to cast from
a base class to a derived class? How does this magic work?
MyTypedDataSet typedDataSet;
// ... fill the typed DataSet with some data
// Serailize
typedDataSet.WriteXml("filename.dat");
// Deserialize into an untyped DataSet
DataSet ds = new DataSet();
ds.ReadXml("filename.dat");
// I wouldn't expect this to work
MyTypedDataSet newTypedDataSet = (MyTypedDataSet) ds;
below. This seems counterintuitive to me - isn't it attempting to cast from
a base class to a derived class? How does this magic work?
MyTypedDataSet typedDataSet;
// ... fill the typed DataSet with some data
// Serailize
typedDataSet.WriteXml("filename.dat");
// Deserialize into an untyped DataSet
DataSet ds = new DataSet();
ds.ReadXml("filename.dat");
// I wouldn't expect this to work
MyTypedDataSet newTypedDataSet = (MyTypedDataSet) ds;