相关疑难解决方法(0)

如何在C#中将结构转换为字节数组?

如何在C#中将结构转换为字节数组?

我已经定义了这样的结构:

public struct CIFSPacket
{
    public uint protocolIdentifier; //The value must be "0xFF+'SMB'".
    public byte command;

    public byte errorClass;
    public byte reserved;
    public ushort error;

    public byte flags;

    //Here there are 14 bytes of data which is used differently among different dialects.
    //I do want the flags2. However, so I'll try parsing them.
    public ushort flags2;

    public ushort treeId;
    public ushort processId;
    public ushort userId;
    public ushort multiplexId;

    //Trans request
    public byte wordCount;//Count of parameter words defining the data …
Run Code Online (Sandbox Code Playgroud)

c# struct

72
推荐指数
6
解决办法
12万
查看次数

标签 统计

c# ×1

struct ×1