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);
权限
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。