Using Expression to 'Cast' Func<object, object> to Func<T, TRet>
问题 I've written a little function that attempts to do the following dynamically: Func<object, object> fa = i => Convert.ChangeType(i, typeof (string)); Func<int, string> fb = o => (string) fa((int)o); The func is as follows: /// <summary> /// Converts <see cref="Func{object, object}" /> to <see cref="Func{T, TResult}" />. /// </summary> public static Delegate Convert(Func<object, object> func, Type argType, Type resultType) { Contract.Requires(func != null); Contract.Requires(resultType != null)