如何從Func<T, TResult>
獲取屬性名稱?從功能獲取屬性名稱<t, T>
有很多帖子如何獲得道具的名字,但是從Expression
而不是從Func
_resultViewModel.SelectMeasurement(si => si.Height, vm => vm.HeightImg); // this is usage... I need to get "Height"
public void SelectMeasurement(Func<ScanInfo, double> measurement, Func<ResultViewModel, ImageSource> image)
{
//some stuff
}
選中此:http://stackoverflow.com/questions/671968/retrieving-property-name-from-lambda-expression –
這是一個閉包,而不是一個屬性。 – aevitas