IPacket.WriteBytes 方法

更新:2007 年 11 月

向对象中写入一个字节数组。

命名空间:  Microsoft.SmartDevice.DeviceAgentTransport
程序集:  Microsoft.SmartDevice.DeviceAgentTransport(在 Microsoft.SmartDevice.DeviceAgentTransport.dll 中)

语法

声明
Sub WriteBytes ( _
    buffer As Byte(), _
    in_bufferSize As UInteger _
)
用法
Dim instance As IPacket
Dim buffer As Byte()
Dim in_bufferSize As UInteger

instance.WriteBytes(buffer, in_bufferSize)
void WriteBytes(
    byte[] buffer,
    uint in_bufferSize
)
void WriteBytes(
    [InAttribute] array<unsigned char>^ buffer, 
    [InAttribute] unsigned int in_bufferSize
)
function WriteBytes(
    buffer : byte[], 
    in_bufferSize : uint
)

参数

  • buffer
    类型:array<System.Byte[]

    要向数据包中写入的字节数组。

  • in_bufferSize
    类型:System.UInt32

    指定要从缓冲区中写入到数据包中的字节数。

示例

    packet = PacketFactory.GetNewPacket()

    ' Write the version of .NET Compact Framework into the packet.
    packet.WriteString("Hello Desktop Computer")
    packet.WriteInt32(Environment.Version.Major)
    packet.WriteInt32(Environment.Version.Minor)
    packet.WriteInt32(Environment.Version.Build)
    packet.WriteInt32(Environment.Version.Revision)

    ' Pass the packet to desktop application.
    packetStream.Write(packet)

End Sub 'Main
packet = PacketFactory.GetNewPacket();

// Write the version of .NET Compact Framework into the packet.
packet.WriteString("Hello Desktop Computer");
packet.WriteInt32(Environment.Version.Major);
packet.WriteInt32(Environment.Version.Minor);
packet.WriteInt32(Environment.Version.Build);
packet.WriteInt32(Environment.Version.Revision);

// Pass the packet to desktop application.
packetStream.Write(packet);

权限

另请参见

参考

IPacket 接口

IPacket 成员

Microsoft.SmartDevice.DeviceAgentTransport 命名空间