I need to do the method below working
ExposeProperty((a) => a.Name); //not work
Error: Member 'Account2.Name' cannot be accessed with an instance reference; qualify it with a type name instead
public class Account2
{
public static string Name
{
get { return "Foo"; }
}
}
public class CustomReport<TEntity>
{
public static void ExposeProperty<TProp>(Expression<Func<TEntity, TProp>> property)
{
//...
}
public static void ExposeProperty<TProp>(Expression<Func<TProp>> property)
{
//...
}
}
public class AccountCustomReport2 : CustomReport<Account2>
{
public static void Main()
{
ExposeProperty((a) => a.Name); //not work
ExposeProperty(() => Account2.Name); //work
}
}