Structuresgot default constructors for example if i do
type tagONEDEV_FlowRec =
struct
.......
end
I can do it new DeviceModel.tagONEDEV_FlowRec(), but this will not work with this:
let (<++|) device bytes size =
let unmanagedPtr = Marshal.AllocHGlobal(size : int)
Marshal.Copy( (bytes : byte array), 0, unmanagedPtr, size)
Marshal.PtrToStructure(unmanagedPtr, (device : obj))
Marshal.FreeHGlobal(unmanagedPtr)
I need a post class here
[<type:StructLayout(LayoutKind.Sequential, Pack=1, CharSet=CharSet.Ansi)>]
type tagONEDEV_FlowRec = {
mutable ....;}
or
type tagONEDEV_FlowRec =
class
.......
end
but there is no default constructor here, and the structures are very large so that they can be initialized manually, so how can I use such classes with standard constructors?
If I donβt find a solution, I think it will be faster for me to transcode this part to C # or even to VB.NET. Sounds like a crutch solution, but it looks like I still canβt dial the F # OOP number.
addition: the thing I do not want to print is:
{TimeRec = 0;
Num = 0us;
FlagErr = 0us;
C6 = 0.0;
C2H6 = 0.0;
C3H8 = 0.0;
CH4 = 0.0;
CO2 = 0.0;
iC4H10 = 0.0;
iC5H12 = 0.0;
neoC5H12 = 0.0;
N2 = 0.0;
nC5H12 = 0.0;
O2 = 0.0;
nC4H10 = 0.0;
He = 0.0;
H2 = 0.0;
H2O = 0.0;
id = 0us; }
<, this is what I want to have by default, because I have a lot of lager structures, then this, and writing such conductors will be evil.