static void insim_PacketReceived(object sender, PacketEventArgs e)
{
// Use reflection to get the packet properties.
var properties = e.Packet.GetType().GetProperties();
// Print out each packet property and its value.
foreach (var property in properties)
{
Console.WriteLine("{0}: {1}", property.Name, property.GetValue(e.Packet, null));
}
// Blank line.
Console.WriteLine();
}
I was referring to this code, where you use reflection to get the properties of a packet. Reflection is a bit slow and it's fine when there are not many calls. But (if I remember correctly) minimum InSim packets per second is 3, so it might be a problem. GetType is probably all right, but GetProperties (and maybe some others) is likely to be slow.