LINQ to JSon响应 [英] LINQ to JSon response
本文介绍了LINQ to JSon响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经在下面发布我的课程,并附上示例数据。我需要传递这个类作为json响应。
[Serializable]
public class Student
{
public string Fname {get; set;}
public string FirstSemMarkcsv {get; set;} //应该用逗号分隔的值。
public string SecondSemMarkcsv {get; set;} //应该用逗号分隔的值。
}
示例数据
Fname FirstSemMark SecondSemMark
John 95 90
John 80 93
John 70 80
Peter 60 78
Peter 80 80
Peter 90 85
我需要将此作为json响应传递。
$ b $任何想法。
b $ b
解决方案
列表< Student> students = GetStudentList();
return Json(students));
I have posted my class below and with sample data. I need to pass this class as an json response.
[Serializable]
public class Student
{
public string Fname {get;set;}
public string FirstSemMarkcsv {get;set;} //This should hold marks as comma separated values.
public string SecondSemMarkcsv {get;set;} //This should hold marks as comma separated values.
}
Sample Data
Fname FirstSemMark SecondSemMark
John 95 90
John 80 93
John 70 80
Peter 60 78
Peter 80 80
Peter 90 85
I need to pass this as json response.
Any thoughts please.
Regards,
Ashish
解决方案
List<Student> students = GetStudentList();
return Json(students));
这篇关于LINQ to JSon响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文