public int CompareTo(ISpecElement other) { var tube = other as Tube; if (tube == null) { return(-1); } var result = Diametr.CompareTo(tube.Diametr); if (result != 0) { return(result); } result = Thickness.CompareTo(tube.Thickness); if (result != 0) { return(result); } result = Length.CompareTo(tube.Length); if (result != 0) { return(result); } return(0); }