I have a 2 lists that contain BreadCrumbItem object:
public BreadcrumbItem()
{
this.Title = string.Empty;
this.Url = string.Empty;
this.BreadcrumbType = BreadcrumbType.None;
}
public enum BreadcrumbType
{
/// <summary>
/// Used for None type.
/// </summary>
None,
/// <summary>
/// Used for Area breadcrumb.
/// </summary>
Area,
/// <summary>
/// Used for Controller breadcrumb.
/// </summary>
Controller,
/// <summary>
/// Used for Action breadcrumb.
/// </summary>
Action
}
I need to join these two lists However, I need to overwrite properties of List1 with properties of List2 (only to those items that have BreadcrumbType specified).
So for example:
var List1 = new List<BreadCrumbItem>()
List1.Add(new BreadcrumbItem(){ "List1Test1", "/home/", "Controller"});
List1.Add(new BreadcrumbItem(){ "List1Test2", "/view/", "Action"});
List1.Add(new BreadcrumbItem(){ "List1Test2", "/view/", null});
var List2 = new List<BreadCrumbItem>()
List2.Add(new BreadcrumbItem(){ "List2Test1", "/test/", "Controller"});
List2.Add(new BreadcrumbItem(){ "List2Test2", "/test3/", null});
List2.Add(new BreadcrumbItem(){ "List2Test3", "/test3/", null});
after the join I’m suppose to have a list that has the following items:
List2Test1
List1Test2
List1Test2
List2Test2
List2Test3
Order is important.
Please help.
thanks
I ended up not using LINQ: