I am intereted in finding the values from List. I am working on Componentlist. Below are my object structure.
Public Class Component
{
public string Type {get; set;}
public List<ComponentDetails> Details {get; set;}
}
& my ComponentDetails structure is
Public Class ComponentDetails
{
public string Filename {get; set;}
public string Size {get; set;}
public DateTime Date {get; set;}
}
I have two objects namely Source & Destination (of type List<Component>
). I need to get the first item from source and find the details from destination. Objective is to find any differnecs from source to destination in terms of Size & createdDate.
In other words, using loops, get the first item from Source (i.e Name) and get what values will be there in Destination.
Question here is, how to iterate destination items to find the given filename details.
Please Help!.
Please note: Destination can be n numbers. I need to get the source item and get the details from all destinations.
Code Snippet:
protected void btnGetComparisionResult_Click(object sender, EventArgs e)
{
List<Components> sourceComponents = GetSourceComponents();
List<Components> destinationComponent = GetDestinationComponents();
foreach (var pitem in sourceComponents) // ParentItem - Component Class
{
foreach (var citem in pitem.ComponentDetails) //Child Item - ComponentDetail Class
{
//here I need to pass "citem.Name" as input and
//need to get the details from Detination.
//IF IT MATCHES, I NEED TO CREATE A REPORT.
//ComponentName SrcSize SrcDate DestSize DestDate.
}
}
}
Finaly, if source has greater size & datetime, we need to take necessary action.