Расширить дочерний объект в родительском объекте C#C#

Место общения программистов C#
Anonymous
 Расширить дочерний объект в родительском объекте C#

Сообщение Anonymous »

Я пытаюсь получить список с деталями регистрации. Список возвращает объект "recalments.user".
Список вывода < /p>
var enrolementList = JsonConvert.DeserializeObject(responseString);

foreach (var enrolement in enrolementList)
{
InsertEnrolementData(enrolement);
}
< /code>
class Enrolements
{
public int enrollment_id { get; set; }
public string content_type { get; set; }
public string module_name { get; set; }
public EnrolmentUsers user { get; set; }
public string campaign_name { get; set; }
public string enrollment_date { get; set; }
public string start_date { get; set; }
public string completion_date { get; set; }
public string status { get; set; }
public int time_spent { get; set; }
public bool policy_acknowledged { get; set; }
}
< /code>
class EnrolmentUsers
{
public int id;
public string first_name;
public string last_name;
public string email;
public string employee_number;

}
< /code>
I want to expand the child objects within the parent list retrieved.
What i have already tried:
I have tried to add the below code in however this only pulls the list of child objects. When I want them to show in the parent list.
var allChildren = enrolementList.Select(parent => parent.user).ToList();


Подробнее здесь: https://stackoverflow.com/questions/794 ... ct-c-sharp

Вернуться в «C#»