日期:2014-05-20 浏览次数:21004 次
string countryDHLId = "Area" + countryInfo.DHLArea.ToString();
var info = from df in db.DHLFreights
  where df.WeightMax >= weight && df.WeightMin <= weight
  select new
  {
  countryDHLId
  };
double dhlFreight = double.Parse(info.First().countryDHLId);
string countryDHLId = "Area" + countryInfo.DHLArea.ToString();
var info = from df in db.DHLFreights
  where df.WeightMax >= weight && df.WeightMin <= weight
  select GetPropertyValue(df,countryDHLId);
private static object GetPropertyValue(object obj, string property)
{
    System.Reflection.PropertyInfo propertyInfo=obj.GetType().GetProperty(property);
    return propertyInfo.GetValue(obj, null);
}