In one section of my application, I use type generated from xsd scheme – I have 2 version of schemas 2008 and 2009 – type I use is DatumType – in every scheme this type contain the same properties – they are exact, except namespaces.
Is there any way how to cast DatumType (2008) to DatumType (2009) so I can work in my application only with one type, instead of two?
I am working with c# and win forms, thanks!
No, there is no way to cast one to the other, because these are two unrelated types, as far as the compiler knows.
If the fields of the target type are assignable, you can write a short method that uses reflection to copy the fields.
You could also build code that saves objects of the source type to XML, and reads that XML into the objects of the target type. This is slightly more fragile, because it relies on the presence of identical fields and the fact that they are converted to XML in the same way.