我希望能够获得传递给函数的变量的原始名称,如下所示:
def orig_var_name(var)
var.calling_method_arg_name # or something
end
orig_var_name(my_var)
#--> "my_var"
Ruby中可能有这样的东西吗?我目前正在使用2.3.1,但我不受这个版本的限制。
答案 0 :(得分:0)
从评论中实现这个想法,但我重申它非常脆弱,并且是一个非常糟糕的想法。
using (var context = new MyDbContext())
{
var result = (from employee in employees
join catalog in context.InOrgCatalogs
on new { Alias = employee.Alias, Active = true } equals
new { Alias = catalog.Alias, Active = catalog.Active } into ps
from p in ps.DefaultIfEmpty()
let temp = employee.InOrg = (p != null)//it will do the work
select employee).ToList();
}