Partager via


PacketFactory.GetNewPacket, méthode

Mise à jour : novembre 2007

Crée un objet de paquet qui implémente l'interface IPacket.

Espace de noms :  Microsoft.SmartDevice.DeviceAgentTransport
Assembly :  Microsoft.SmartDevice.DeviceAgentTransport (dans Microsoft.SmartDevice.DeviceAgentTransport.dll)

Syntaxe

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

Valeur de retour

Type : Microsoft.SmartDevice.DeviceAgentTransport.IPacket

Un objet qui implémente IPacket.

Exemples

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

Autorisations

Voir aussi

Référence

PacketFactory, classe

Membres PacketFactory

Microsoft.SmartDevice.DeviceAgentTransport, espace de noms