Compartilhar via


Método PacketFactory.GetNewPacket

Cria um objeto de pacote que implementa o IPacket interface.

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

Sintaxe

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

Valor de retorno

Tipo: Microsoft.SmartDevice.DeviceAgentTransport.IPacket
Um objeto que implementa IPacket.

Exemplos

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

Permissões

Consulte também

Referência

PacketFactory Classe

Membros PacketFactory

Namespace Microsoft.SmartDevice.DeviceAgentTransport