I'm using SharpPcap to capture packets.
I'm trying to get Traffic Class value and I'm using udp.ipv6.TrafficClass.ToString().
the problem that I'm getting this exception:
Object reference not set to an instance of an object.
private void packetCapturingThreadMethod()
{
   Packet packet = null;
   while ((packet = device.GetNextPacket()) != null)
   {
        packet = device.GetNextPacket();
        if (packet is UDPPacket)
        {
            UDPPacket udp = (UDPPacket)packet;
            MessageBox.Show(udp.ipv6.TrafficClass.ToString());
        }
   }
}