score:2
Accepted answer
you can use linq to join both data lists. more about it here.
class plan {
public int plancode { get; set; }
public string planshortname { get; set; }
}
class division {
public int divisioncode { get; set; }
public string divisionname { get; set; }
}
class divisionassignment {
public int plancode { get; set; }
public list<division> divisions { get; set; }
}
public static void joinexample() {
// do your deserialization stuff here
list<plan> plans = ...;
list<divisionassignment> assignments = ...;
// join the data
var query = from plan in plans
join assignment in assignments on plan.plancode equals assignment.plancode
select new { plancode = plan.plancode, divisions = assignment.divisions };
// reach the joined data
foreach (var plandivision in query) {
... = plandivision.plancode;
... = plandivision.divisions;
...
}
}
Source: stackoverflow.com
Related Query
- How to combine two lists with different properties based on a condition in C#
- Given two lists of different objects, how to combine values from each into a new list based on a common Id, efficiently?
- How can i copy data table records of different field name based on mapping list evaluating condition on source data table?
- Using linq c# how can I select using a condition two different lists
- How to merge two lists while adding metadata indicating value source with LINQ statement?
- How to create an EF query which returns a nested list with navigation properties based on different entity ids?
- Combine two lists of entities with a condition
- How to match two Lists with only items that are different in Linq
- how to combine and sum up the result from two lists based on unique id
- How to combine more than two generic lists in C# Zip?
- intersect two lists with different objects
- How to join two Lists based on common property
- How to combine two types of C# lists into one?
- How merge two lists of different objects?
- Combine two potentially null lists with linq
- How to use linq `Except` with multiple properties with different class?
- How to merge two lists based on a property?
- How do I combine two lists to a List<KeyValuePair<>>?
- Using LINQ. With two different lists. How can I identify objects that do not match
- Concatenating two lists of different types with LINQ
- EntityFramework: Retrieve data with a condition on two different context
- How to compare two ordered lists with LINQ?
- how can compare items of two lists with linq?
- How to split a string two times with different separators using LINQ?
- How can I combine this code into one or two LINQ queries?
- How to have a list with different data types of lists in it as a sublists?
- Combine two lists into one based on property
- C# Combine Two Lists With Overlapping Data
- How To Join Tables from Two Different Contexts with LINQ2SQL?
- How do I combine two XElements with linq select?
More Query from same tag
- Duplicate by using LINQ with mulitiple OR creteria
- Difference between two lists with linq
- Linq distinct over multiple columns into dictionary
- LINQ: Using a pivot table in linq
- Always select true/higher value in LINQ statement group by (Multiple columns)
- Sort and Take N from dictionary value in C#
- Remove object from two list by reference
- How can i get sql query Equivalent to a linq expression
- Create a C# Generic class for repeated code
- linq join on null
- Removing duplicates using LINQ returns "Error removing duplicates: Unable to cast object of type 'System.Int32' to type 'System.String'."
- Is there a VB.NET-Like operator in C#?
- extract number of Repetition n of every string in a string list
- Find items with duplicate values over mutiple properties
- Is there a way to do the google did you mean in linq?
- Negating a method call in an Expression tree
- An analog of String.Join(string, string[]) for IEnumerable<T>
- How to return linq query into single object
- Registration Admin Approval verification in C# asp dot net MVC
- Get items from list where inner list contains set of enum-values
- Query Nullable Column Linq to Sql
- LINQ in NEST framework for ElasticSearch
- linq to sql join on multiple columns using lambda error
- Nhibernate 3 - LINQ Issues
- Comparing Dates, ignoring year - Linq/Entity Framework
- How can I have different LINQ to XML queries based on two different condition?
- Can not add multiple conditions to where with left join and group
- How do I query sysobjects with linq?
- Add Max and Average in linq query
- returning specified type for a linq query with anonymous type