class A
{
public string[] X {get;set;}
public string[] Y {get;set;}
}
class B
{
public string X {get;set;}
public string Y {get;set;}
}
transfer data of A’s object to B’s array with Linq? suppose Object of A have 10-10 size X and Y and I want to transfer into B array (B[] b = new B[10])
A a = new A();
//put 10 items in both x and y
B[] b = new B[10];
//here I want to get a's data to b
You can use
Zipmethod from LINQ:Or use
Selectwith index:Another way using
Enumerable.Rangeif you get stuck on .NET 3.5: