[英]How to declare ULARGE_INTEGER in c#?
Based upon this question How to declarate LARGE_INTEGER in C# with answer of: 基于此问题, 如何在C#中用以下答案 声明LARGE_INTEGER :
[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? 我下面声明
ULARGE_INTEGER
假设正确吗?
[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. 它只是C#中的一个难题,无需跳过LayoutKind.Explicit箍。 The union was necessary because C and C++ compilers didn't have a native 64-bit type in the olden days.
合并是必要的,因为在过去,C和C ++编译器没有本机64位类型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.