public static Device Load(XmlNode xml) { int type = int.Parse(xml.Attributes["type"].Value); switch (type) { case DeviceType.Type_1: return(DeviceType1.Load(xml)); case DeviceType.Type_2: return(DeviceType2.Load(xml)); default: throw new Exception("Nieobsługiwany typ urządzenia."); } }