Пример #1
0
        public List <DomainExportType> GetBestExports(DomainVersion version)
        {
            //
            // Check for exact version match
            //
            DomainExportVersion found = Exports.SingleOrDefault(v => v.Version == version);

            if (found != null)
            {
                return(found.Types);
            }
            //
            // Else look for the max of all versions less than the specified version
            //
            DomainVersion max = Exports.Where(v => v.Version < version).Max(v => v.Version);

            if (max != null)
            {
                found = Exports.Single(v => v.Version == max);

                return(found.Types);
            }
            //
            // Otherwise just return for the max version
            //
            max = Exports.Max(v => v.Version);

            if (max != null)
            {
                found = Exports.Single(v => v.Version == max);

                return(found.Types);
            }
            //
            // Otherwise there is nothing to return
            //
            return(new List <DomainExportType>());
        }
Пример #2
0
 public DomainVersion GetMaxVersion()
 {
     return(!Exports.Any() ? CurrentVersion : Exports.Max(e => e.Version));
 }