c# 5.0 - Combining two lists with different elements to one list with all elements and SAME index in c# -


i have 2 different lists geocode1 , geocode2 both of 5 rows of records. geocode1 has 4 columns namely address, city, zip , street. geocode2 has 4 columns namely latitute, longitude,status , county

merging them using addrange below:

 geocode1.addrange.(geocode2) 

results in geocode1 8 columns( desire) of 10 rows, first 5 containing values in first list (geocode1) , last 5 values 2nd list (geocode2). (like outer join in sql)

i desire have 8 columns 5 rows elements of both lists combined inner join in sql. can provide me solution?

you need zip that:

var result = geocode1.zip(geocode2, (c1, c2) => new modelname          {            address = c1.address,            city = c1.city,            zip = c1.zip            street. c1.street,            latitute = c2.latitude            longitude = c2.longitude,            status = c2.status,            country = c2.country          }).tolist();  

make sure both list have same number of length since zip follow shortest list.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -