예제 #1
0
        private ConversionInfo GetConversionWithoutCache(Type sourceType, Type targetType)
        {
            ConversionInfo best = ConversionInfo.Null;

            foreach (IConversionRule rule in rules)
            {
                ConversionCost cost = rule.GetConversionCost(sourceType, targetType, this);
                if (cost.CompareTo(best.Cost) < 0 && !cost.IsInvalid)
                {
                    best = new ConversionInfo(cost, rule);
                }
            }

            return(best);
        }
예제 #2
0
 public ConversionInfo(ConversionCost cost, IConversionRule rule)
 {
     Cost = cost;
     Rule = rule;
 }