items[Name] items[Surname]
VMStudent.cs public void GetStudents(){ var query=""; //linq queries DataTable newTbl=new DataTable(); newTbl.Columns.Add("Name"); newTbl.Columns.Add("Surname"); foreach(var items in query); { newTbl.Rows.Add(items); Students std=new Students(); std.Name=items["Name"].ToString(); // items is error and red color. std.Surname=items["SurnameName"].ToString(); // items is error and red color. StudentList.Add(std); 2.way try newTbl.Rows.Add(items); Students std=new Students(); std.Name="Name".ToString(); std.Surname=items"Surname".ToString(); // name and surname is equal to not values.Equals is Name=Name and Surname=surname StudentList.Add(std); } } StudentsCall.cs StudentList=GetStudents(); object reference not instance of an object Student.cs private string Name; private string Surname
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)