string _col1 = "first name"; string _name; var query = from c in ctx.Customers select c; _name = query.FirstOrDefault().[_name];
据我所见,我只能得到强类型的字段名称,但我想提供它们作为字符串变量.
string name = typeof(Customer) .GetProperty("first name") .GetValue(query.First(),null) as string;
我猜你正在处理的EF类被称为客户.