[code]Structure Struct1
Value As Integer
End Structure
Structure Struct2
Value As Integer
Value2 As Integer
End Structure
Dim s1 As Struct1
s1.Value = 1234
Dim s2 As Struct2 = CType(s1, Struct2)
// s2 now looks like this:
// s2.Value = 1234
// s2.Value2 = 0[/code]
Is it intended that CType converts between non-identical structures?
Because this also compiles:
[code]Structure Struct1
Value As Integer
End Structure
Structure Struct2
Value As CString // Note that this not the same data type as the first field in Struct1
Value2 As Integer
End Structure
Dim s1 As Struct1
s1.Value = 1234
Dim s2 As Struct2 = CType(s1, Struct2)
// CRASH when accessing the structure (the assigment itself works)[/code]