문제

Based upon this question How to declarate LARGE_INTEGER in C# with answer of:

[StructLayout(LayoutKind.Absolute, Size=8)]
struct LARGE_INTEGER
{
    [FieldOffset(0)]public Int64 QuadPart;
    [FieldOffset(0)]public UInt32 LowPart;
    [FieldOffset(4)]public Int32 HighPart;
}

Is my assumption below for declaring ULARGE_INTEGER correct?

[StructLayout(LayoutKind.Explicit, Size = 8)]
public struct ULARGE_INTEGER
{
    [FieldOffset(0)] public UInt64 QuadPart;
    [FieldOffset(0)] public UInt32 LowPart;
    [FieldOffset(4)] public UInt32 HighPart;
}
도움이 되었습니까?

해결책

It is simply an ulong in C#, no need to jump through the LayoutKind.Explicit hoop. The union was necessary because C and C++ compilers didn't have a native 64-bit type in the olden days.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top