When returning the following function
public Guid GetUserFilterValue( string filterID )
As
Func<string, object>
I am getting the error that it has the wrong return type. If I change the return type to anything other than Guid it compiles. Any ideas?
This would usually work if the return type was a reference type, because
Func<T, TResult>is covariant for T; butGuidis a value type, this is why your method is not a valid candidate forFunc<string, object>.From MSDN:
As a workaround, you could use a lambda expression: