/// <summary> /// Gets a specific layer of a packet /// </summary> /// <typeparam name="T">Type of layer to locate</typeparam> /// <param name="packet">Packet to search</param> /// <returns>Requested layer, or null if it is not found</returns> public static T Layer <T>(this IPacket packet) where T : IPacket { return(packet.Layers().OfType <T>().SingleOrDefault()); }