更新:2007 年 11 月
用于获取实现 IPacket 的对象。
命名空间:  Microsoft.SmartDevice.DeviceAgentTransport
程序集:  Microsoft.SmartDevice.DeviceAgentTransport(在 Microsoft.SmartDevice.DeviceAgentTransport.dll 中)
语法
声明
Public NotInheritable Class PacketFactory
用法
不需要声明静态类的实例来访问其成员。
public static class PacketFactory
public ref class PacketFactory abstract sealed
public final class PacketFactory
备注
请勿创建此类型的对象。此类的目的是获取实现 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);
继承层次结构
System.Object
  Microsoft.SmartDevice.DeviceAgentTransport.PacketFactory
线程安全
此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。