following is my code, i don't know why DateTime can not change to Object , any idea to resolve this problem?
public class Test
{
public DateTime CreatedTime { get; set; }
}
public class Test1
{
}
public class Test2 : Test1
{
}
static void Main(string[] args)
{
Func<Test, ArgumentException> fn1 = null;
Func<Test, Exception> fn2 = fn1;// success
Func<Test, Test2> fn3 = null;
Func<Test, Test1> fn4 = fn3;//success
Func<Test, DateTime> expression1 = p => p.CreatedTime;
Func<Test, object> s = expression1; // Cannot implicitly convert type 'System.Func<IlReader.Program.Test,System.DateTime>' to 'System.Func<IlReader.Program.Test,object>'
Func<Test, ValueType> s2 = expression1; // cannot implicatily convert ....
}