public class SomePropertyClass{
public string VarA{get;set;}
public string VarB{get;set;}
}
SomePropertyClass v1 = new SomePropertyClass(){VarA = "item 1"};
SomePropertyClass v2 = new SomePropertyClass(){VarB = "item 2"};
Is it possible to create a third variable that will have:
v3: VarA = "item 1",VarB = "item 2"
I mean, I want to merge objects with linq to object.
Edit
for now i need from the same type. but it would be nice in the future to merge by property name.
I have an account model with a lot of properties that the user input in step 1.
I want to merge this half full model with step 2 half full model.
Edit 2
//step 1
GlobalOnBoardingDataModel step1= (GlobalOnBoardingDataModel)HttpContext.Current.Session[SessionVariableNameStepOne];
//step 2
GlobalOnBoardingDataModel step2 = (GlobalOnBoardingDataModel)HttpContext.Current.Session[SessionVariableNameStepTwo];
class GlobalOnBoardingDataModel {
public string Email;//step 1
public string Name;//step 1
public string Phone;//step2
public string Address;//step2
}
}
thanks
var v3 = new SomePropertyClass { VarA = v1.VarA, VarB = v2.VarB };? Why would you want to use LINQ ?