Freigeben über


PacketFactory.GetNewPacket-Methode

Aktualisiert: November 2007

Erstellt ein Paketobjekt, durch das die IPacket-Schnittstelle implementiert wird.

Namespace:  Microsoft.SmartDevice.DeviceAgentTransport
Assembly:  Microsoft.SmartDevice.DeviceAgentTransport (in Microsoft.SmartDevice.DeviceAgentTransport.dll)

Syntax

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

Rückgabewert

Typ: Microsoft.SmartDevice.DeviceAgentTransport.IPacket

Ein Objekt, das IPacket implementiert.

Beispiele

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

Berechtigungen

Siehe auch

Referenz

PacketFactory-Klasse

PacketFactory-Member

Microsoft.SmartDevice.DeviceAgentTransport-Namespace