private OperatorImplementation FindBaseImplementation(ExpressionType op, Type commonType) { var baseKey = new OperatorDispatchKey(op, commonType, commonType); OperatorImplementations.TryGetValue(baseKey, out OperatorImplementation baseImpl); return(baseImpl); }
// Important: returns null if fromType == toType public virtual UnaryOperatorMethod GetConverter(Type fromType, Type toType) { if (fromType == toType) { return(x => x); } var key = new OperatorDispatchKey(ExpressionType.ConvertChecked, fromType, toType); return(!OperatorImplementations.TryGetValue(key, out OperatorImplementation impl) ? null : impl.Arg1Converter); }