C
Charles Law
Suppose I have a structure
Private Structure MyStruct
Dim el1 As Byte
Dim el2 As Int16
Dim el3 As Byte
End Structure
I want to convert this into a byte array where
Dim st as MyStruct
Dim arr(3) As Byte
arr(0) = st.el1
arr(1) = st.el2 >> 8
arr(2) = st.el2 And &HFF
arr(3) = st.el3
Is there a neat way to do this in the NET Framework? Ideally, it would be
generic, so that it doesn't have to be hand coded for each different
structure that I have. It would also be nice to be able to specify big or
little endian, in the case of el2.
Thanks
Charles
Private Structure MyStruct
Dim el1 As Byte
Dim el2 As Int16
Dim el3 As Byte
End Structure
I want to convert this into a byte array where
Dim st as MyStruct
Dim arr(3) As Byte
arr(0) = st.el1
arr(1) = st.el2 >> 8
arr(2) = st.el2 And &HFF
arr(3) = st.el3
Is there a neat way to do this in the NET Framework? Ideally, it would be
generic, so that it doesn't have to be hand coded for each different
structure that I have. It would also be nice to be able to specify big or
little endian, in the case of el2.
Thanks
Charles