Пример #1
0
        /// <inheritdoc/>
        public virtual bool TryGetFact <TFact>(out TFact fact) where TFact : IFact
        {
            var   destFactType = GetFactType <TFact>();
            IFact innerFact    = ContainerList
                                 .Where(f => f.GetFactType().EqualsFactType(destFactType))
                                 .OrderByDescending(f => f, Comparer ?? Comparer <IFact> .Create((x, y) => x.CompareTo(y)))
                                 .FirstOrDefault();

            if (innerFact == null)
            {
                fact = default;
                return(false);
            }
            else
            {
                fact = (TFact)innerFact;
                return(true);
            }
        }