BTDB.FieldHandler.DefaultTypeConvertorGenerator.GenerateConversion C# (CSharp) Method

GenerateConversion() public method

public GenerateConversion ( Type from, Type to ) : Action
from System.Type
to System.Type
return Action
        public virtual Action<IILGen> GenerateConversion(Type from, Type to)
        {
            if (from == to) return ilg => { };
            if (!from.IsValueType && to == typeof(object))
            {
                return i => i.Castclass(to);
            }
            if (from == typeof(object) && !to.IsValueType)
            {
                return i => i.Isinst(to);
            }
            Action<IILGen> generator;
            if (_conversions.TryGetValue(new Tuple<Type, Type>(from, to), out generator))
            {
                return generator;
            }
            if (from.IsEnum && to.IsEnum) return GenerateEnum2EnumConversion(from, to);
            return null;
        }