I need to grab the value of a property of an ObjectB, which is a Property of ObjectA and ObjectA is inside of a List<ObjectA>
I browsed through some examplse, but could not find exactly what I need.
Here is what I'm looking for:
I have a class MyScreenClass
, that has a List<TicketReportPropertyEntity>
:
public class MyScreenClass
{
public List<TicketReportPropertyEntity> TicketReportPropertyEntities{ get; set; }
}
This is TicketReportPropertyEntity
class that has another class which property I need to work with:
public class TicketReportPropertyEntity
{
public decimal Amount{get;set;}
public ReportPropertyEntity ReportProperty {get;set;}
}
This is ReportPropertyEntity
class:
public class ReportPropertyEntity
{
public string PropertyName { get; set; }
}
What I need to do, is for each TicketReportPropertyEntity
to get Amount
from TicketReportPropertyEntity
and PropertyName
from ReportPropertyEntity
.
The purpose is I need to compare the PropertyName
with a given property and set the value to an Amount
So far, I only came up with the following:
foreach (var ticketReportEntity in mol.TicketReportPropertyEntities)
{
PropertyInfo propertyInfo1 = ticketReportEntity.GetType().GetProperty("ReportProperty");
//here I need to do all the logic
}
What is the solution?
Aucun commentaire:
Enregistrer un commentaire