Condividi tramite


Metodo PacketFactory.GetNewPacket

Aggiornamento: novembre 2007

Crea un oggetto pacchetto che implementa l'interfaccia IPacket.

Spazio dei nomi:  Microsoft.SmartDevice.DeviceAgentTransport
Assembly:  Microsoft.SmartDevice.DeviceAgentTransport (in Microsoft.SmartDevice.DeviceAgentTransport.dll)

Sintassi

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

Valore restituito

Tipo: Microsoft.SmartDevice.DeviceAgentTransport.IPacket

Oggetto che implementa l'oggetto IPacket.

Esempi

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

Autorizzazioni

Vedere anche

Riferimenti

PacketFactory Classe

Membri PacketFactory

Spazio dei nomi Microsoft.SmartDevice.DeviceAgentTransport