共用方式為


PacketFactory.GetNewPacket 方法

更新:2007 年 11 月

建立實作 IPacket 介面的封包物件。

命名空間:  Microsoft.SmartDevice.DeviceAgentTransport
組件:  Microsoft.SmartDevice.DeviceAgentTransport (在 Microsoft.SmartDevice.DeviceAgentTransport.dll 中)

語法

Public Shared Function GetNewPacket As IPacket

Dim returnValue As IPacket

returnValue = PacketFactory.GetNewPacket()
public static IPacket GetNewPacket()
public:
static IPacket^ GetNewPacket()
public static function GetNewPacket() : IPacket

傳回值

型別:Microsoft.SmartDevice.DeviceAgentTransport.IPacket

實作 IPacket 的物件。

範例

    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);

使用權限

請參閱

參考

PacketFactory 類別

PacketFactory 成員

Microsoft.SmartDevice.DeviceAgentTransport 命名空間