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);
使用權限
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。