как получить значение элемента List
Есть лист student
на основе класса Student
:
public class Student
{
public static int id_account { get; set; }
public static int id_student { get; set; }
public static string second_name { get; set; }
public static string name_ { get; set; }
public static string patronymic { get; set; }
public static int id_group { get; set; }
public static DateTime date_birthday { get; set; }
public static string number_phone { get; set; }
public static string number_phone_parent { get; set; }
public static string number_phone_parent_second { get; set; }
public static string series_passport { get; set; }
public static string number_passport { get; set; }
public static string code_dep { get; set; }
public static byte[] photo { get; set; }
public static string login { get; set; }
public static string password { get; set; }
public static string id_specialization { get; set; }
public static string number_course { get; set; }
public static string char_group { get; set; }
public static string commerce { get; set;}
}
Мне необходимо вытащить id_group
, поэтому указываю student[5]
. Но выходит ошибка, что я вышел за пределы диапазона, после откладки понимаю, что элементов в листе только 1. Возможно из-за того, что я выгружаю из бд в виде DataTable
.
Вопрос, как мне вытянуть элемент из листа
Источник: Stack Overflow на русском