12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace WpfApp3.model
- {
- public class JSONDataProvider
- {
- private List<Student> _StudentList;
- public JSONDataProvider()
- {
- var serializer = new DataContractJsonSerializer(typeof(Student[]));
- using (var sr = new StreamReader("./test.json"))
- {
- _StudentList = ((Student[])serializer.ReadObject(sr.BaseStream)).ToList();
- }
- }
- public IEnumerable<Student> getStudents()
- {
- return _StudentList;
- }
- }
- internal class DataContractJsonSerializer
- {
- private Type type;
- public DataContractJsonSerializer(Type type)
- {
- this.type = type;
- }
- internal Student[] ReadObject(Stream baseStream)
- {
- throw new NotImplementedException();
- }
- }
- }
|