It’s the first (and probably only) Friday Programming Challenge! 

Today’s task is simple.  How can we pass a generic Func<T,object> to a method that only accepts a Func<object,object>?  Specifically, how can we make this code compile?

internal interface ISerializationConfig
{
    ...
    void SerializePropertyAsElementUsing(Type target, 
             PropertyInfo property, 
             string elementName, 
             Func<object, object> converter);
}


... 

ITypeSerializationSpec<T> IInitialPropertySerializationSpec<T>.Using(Func<T, object> selector)
{
    //_config is of type ISerializationConfig. 
    _config.SerializePropertyAsElementUsing(typeof(T), 
               _expression.GetProperty(), 
               _expression.GetProperty().Name, 
               /*ERROR:*/ selector);
    return this;
}

...

For context, this is part of a library I’m working on for more flexible XML serialization/deserialization.  The Domain-Specific Language (DSL) for specifying custom serialization behavior is all strongly typed using generics.  Internally though, serialization is loosely typed and works using reflection.  The code above is basically the "bridge” that takes the specification via the DSL and stores it for use by the reflection-based core, hence the need to go from a generic Func<T,object> to a loosely-typed Func<object,object>.