public static void BindCustom <TSource, TTarget>(Func <TSource, TTarget> mapper) { TypePair typePair = TypePair.Create <TSource, TTarget>(); if (mapper == null) { throw new ArgumentNullException(nameof(mapper)); } Func <object, object> innerMapper = x => mapper((TSource)x); CustomMapper.Add(typePair, innerMapper); }