Example #1
0
        /// <summary>
        /// returns a list of all elevations that are directly or indirectly linked to <c>currentInfo</c>.
        /// sometimes one elevation belongs to multiple basic elevations.
        /// the return family will contain all of them.
        /// </summary>
        public static IEnumerable <NetInfo> GetRelatives(this NetInfo netinfo)
        {
            try {
                if (netinfo == null)
                {
                    return(null);
                }

                HashSet <NetInfo> family = new HashSet <NetInfo>(netinfo.GetDirectlyRelated());

                // get elevations that are indirectly linked to currentInfo.
                foreach (var netinfo2 in family.ToArray())
                {
                    family.AddRange(netinfo2.GetDirectlyRelated());
                }

                return(family);
            } catch (Exception ex) {
                ex.LogException();
                return(new[] { netinfo });
            }
        }