public static Expression CreateAssignExpression( [NotNull] this MemberExpression left, [NotNull] Expression right) { var leftType = left.Type; if (leftType != right.Type && right.Type.GetTypeInfo().IsAssignableFrom(leftType.GetTypeInfo())) { right = Expression.Convert(right, leftType); } return(left.Assign(right)); }