using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp
{
public class Ye
{
public string Y { get; set; }
public string E { get; set; }
}
public class Hao
{
public string H { get; set; }
public string A { get; set; }
public string O { get; set; }
}
class Program
{
static void Main(string[] args)
{
List yes = new List() {
new Ye() { E = "e1", Y = "y1" },
new Ye() { E = "e2", Y = "y2" },
new Ye() { E = "e3", Y = "y3" },
};
List haos = new List()
{
new Hao(){ A="A1", H="H1", O="O1" },
new Hao(){ A="A2", H="H2", O="O2" },
new Hao(){ A="A3", H="H3", O="O3" }
};
//笛卡尔积
var data = from d in yes
from t in haos
select new { d, t };
//笛卡尔积
var data1 = from d in yes
from t in haos
select new
{
d.E,
d.Y,
t.A,
t.H,
t.O
};
Console.Read();
}
}
}