private ConversionInfo GetConversion(Type sourceType, Type targetType)
        {
            lock (conversions)
            {
                var            key = new ConversionKey(sourceType, targetType);
                ConversionInfo conversion;

                if (!conversions.TryGetValue(key, out conversion))
                {
                    // Try to get a custom user converter.
                    Conversion operation = extensionPoints.CustomConverters.Find(key);

                    if (operation != null)
                    {
                        var rule = new CustomConversionRule(operation);
                        conversion = new ConversionInfo(ConversionCost.Best, rule);
                    }
                    else
                    {
                        // Note: We add a null info record while populating the cache so as to handle
                        // potentially recursive lookups by preventing them from being satisfied.
                        conversions.Add(key, ConversionInfo.Null);
                        conversion = GetConversionWithoutCache(sourceType, targetType);
                    }

                    conversions[key] = conversion;
                }

                return(conversion);
            }
        }
        private ConversionInfo GetConversion(Type sourceType, Type targetType)
        {
            lock (conversions)
            {
                var key = new ConversionKey(sourceType, targetType);
                ConversionInfo conversion;

                if (!conversions.TryGetValue(key, out conversion))
                {
                    // Try to get a custom user converter.
                    Conversion operation = extensionPoints.CustomConverters.Find(key);

                    if (operation != null)
                    {
                        var rule = new CustomConversionRule(operation);
                        conversion = new ConversionInfo(ConversionCost.Best, rule);
                    }
                    else
                    {
                        // Note: We add a null info record while populating the cache so as to handle
                        // potentially recursive lookups by preventing them from being satisfied.
                        conversions.Add(key, ConversionInfo.Null);
                        conversion = GetConversionWithoutCache(sourceType, targetType);
                    }

                    conversions[key] = conversion;
                }

                return conversion;
            }
        }