我有一些动态数据,如下所示:
颜色:[红色,蓝色,绿色]
尺寸:[S,M,L]
类型:[男人,女人]
现在我该如何创建这样的动态矩阵表:
I can't post images so please see this link: http://79.175.176.69/table.png
答案 0 :(得分:2)
这样的事情可能会给你你想要的结果。
var colors = new [] { "Red","Green","Blue" };
var sizes = new[] { "S", "M", "L" };
var gender = new[] { "Female", "Male"};
var matrix = from c in colors
from s in sizes
from g in gender
select new { color = c, size = s, gender = g };