I have the following code:
public class Info
{
public string Name;
public string Num;
}
string s1 = "a,b";
string s2 = "1,2";
IEnumerable<Info> InfoSrc =
from name in s1.Split(',')
from num in s2.Split(',')
select new Info()
{
Name = name,
Num = num
};
List<Info> listSrc = InfoSrc.ToList();
I would like my listSrc result to contain two Info items whose Name and Num properties are:
a, 1
b, 2
However, the code I show above results in four items:
a, 1
a, 2
b, 1
b, 2
Enumerable.Zip.