繁体   English   中英

我有一个C#代码。 我想在vb.net中将其转换。 但是我无法转换不安全且固定的关键字

[英]I have a C# code. I want to convert it in vb.net. But I am unable to convert unsafe and fixed key word

不安全且已在vb.net中修复

 [StructLayout(LayoutKind.Sequential, Pack = 1)]
    public unsafe struct SGDeviceInfoParam
    {
        private const int SGDEV_SN_LEN = 15;        // Device Serial Number Length

        public UInt32 DeviceID; 

**这是问题** // 0-9

public fixed Byte DeviceSN[SGDEV_SN_LEN + 1]; // Device Serial Number, Length of SN = 15
            public UInt32 ComPort;                      // Parallel device=>PP address, USB device=>USB(0x3BC+1)
            public UInt32 ComSpeed;                     // Parallel device=>PP mode, USB device=>0 
            public UInt32 ImageWidth;                   // Image Width
            public UInt32 ImageHeight;                  // Image Height
            public UInt32 Contrast;                     // 0 ~ 100
            public UInt32 Brightness;                   // 0 ~ 100
            public UInt32 Gain;                         // Dependent on each device
            public UInt32 ImageDPI;                     // DPI
            public UInt32 FWVersion;                    // FWVersion
        }

这是我的努力,但我不满意

  <StructLayout(LayoutKind.Sequential, Pack:=1)>
Public Structure SGDeviceInfoParam

    Private Const SGDEV_SN_LEN As Integer = 15

    ' Device Serial Number Length
    Public DeviceID As UInt32

    ' Device Serial Number, Length of SN = 15
    Public ComPort As UInt32

    ' Parallel device=>PP address, USB device=>USB(0x3BC+1)
    Public ComSpeed As UInt32

    ' Parallel device=>PP mode, USB device=>0 
    Public ImageWidth As UInt32

    ' Image Width
    Public ImageHeight As UInt32

    ' Image Height
    Public Contrast As UInt32

    ' 0 ~ 100
    Public Brightness As UInt32

    ' 0 ~ 100
    Public Gain As UInt32

    ' Dependent on each device
    Public ImageDPI As UInt32

    ' DPI
    Public FWVersion As UInt32
End Structure

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM