Ho metodo statico come questo:Come Func <DomainObject, object> nome ritorno dell'oggetto come stringa
public static string MyMethod(Func<Student, object> func)
{
return ??? ;
}
e lo uso come segue:
var s1 = MyMethod(student => student.ID); // Return "ID" ???
var s2 = MyMethod(student => student.Age); // Return "Age" ???
var s3 = MyMethod(student => student.Name); // Return "Name" ???
metodo Come scrittura che restituiscono il seguente risultati?
- s1: "ID"
- s2: "Age"
- s3: "Nome"
* ritorno ogni nome property`s dopo => come stringa
Non è possibile con questa firma - deve essere qualcosa come 'Espressione>'. –
Jon