Convert.ToInt16 and then immediately case it to a PortType. That's not usually needed with enums, is there something odd about portTypeAttrib.Value?