本文介绍了使用点替换实体表替换局部变量的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
mcard_list mcardlist = new mcard_list();
numberoftimes = 0;
timesheet.AddTomcard_list(mcardlist);
while (numberoftimes < collectionnumbers)
{
var FieldName = mcardlistfields[numberoftimes, 0].ToString();
var FieldType = mcardlistfields[numberoftimes, 1].ToString();
switch (FieldType)
{
case "String" :
mcardlist. + FieldName = "Test"; <=I know wrong here but i don't know how to do.
break;
case "DateTime" :
mcardlist. + FieldName = "2015-1-23"; <=I know wrong here I don't know how to do it.
break;
}
numberoftimes += 1;
}
timesheet.SaveChanges();
Could Anyone help me how can add fieldname stored in variable "FieldName" for later attach with "mcardlist." (ended with dot).Thanks.
推荐答案
这篇关于使用点替换实体表替换局部变量的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!