hi,
I need to implement C++ types in c#. Here's my code.
[StructLayout(LayoutKind.Sequential)]
public struct tdUMSFuncValue
{
//[FieldOffset(0)]
[MarshalAs(UnmanagedType.LPTStr)]
public string szName;
//[FieldOffset(2)]
public tdUMSFuncType ft;
//[FieldOffset(4)]
public double dfloat;
//[FieldOffset(6)]
public int lInteger;
//[FieldOffset(8)]
public Int64 time_t;
//[FieldOffset(10)]
[MarshalAs(UnmanagedType.LPTStr)]
public string szString;
}
[StructLayout(LayoutKind.Sequential)]
public struct tdUMSFuncValues
{
public tdUMSFuncValue[] fv;
public int lCt;
public tdUMSFuncValues()
{
tdUMSFuncValue[] fv = new tdUMSFuncValue[11];
fv[0] = new tdUMSFuncValue();
lCt = 0;
}
}
Karthik ElumalaiRank #544 · 4.5K reputationPosted Jun 23, 2016, 7:18 AM EDT
Struct constructors are similar to class constructors, except for the following differences:
Premal Mehta45 reputationPosted Jun 23, 2016, 9:58 AM EDT
the c++ code has this struct.
long lCt; // Number of actual values: 1 to 11
tdUMSFuncValue fv[11]; // Values
} tdUMSFuncValues;
I am trying to recreate this in C# ? how can this be achieved ?
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts