【发布时间】:2016-05-10 07:26:06
【问题描述】:
我有一个包含 Student 类的 WCF,并且只返回一个双(平均)变量:
public class Student
{
public String Name { set; get; }
public String Family { set; get; }
public List<double> GradeList { get;
}
我在我的项目中插入了这个 WCF 现在我可以将数据插入到学生姓名和家庭,但我不能将项目插入到 GradeList 列表中。 像这样:
Student ss = new Student();
ss.Name = txtname.Text;
ss.Family = txtFamily.Text;
// insert from listbox to list
foreach (double strCol in lstGrade.Items)
{
ss.GradeList.add(strCol);
}
但是 "add" 会出错。 谁能帮帮我?
【问题讨论】:
-
您可以添加错误的副本吗?你的班级也很奇怪:
GradeList { get;你忘了完成复制行吗?
标签: c# wcf-data-services