在我 st的情景中,请帮助我。
就像这一点一样。
利用不动产业分类编制了一份动态编制的表和外地清单(见表)。
BindingList<Table> table = new BindingList<Table>(); [Serializable] [TypeConverter(typeof(TableConverter))] public class Table { private string _name = string.Empty; private HeaderCollection _hc = new HeaderCollection(); private BindingList<Fields> _fc = new BindingList<Fields>(); public Guid key; public Table() { key = Guid.NewGuid(); } [DisplayName( "Table Fields" ), Editor( typeof( FieldCollectionEditor ), typeof( UITypeEditor ) )] public BindingList<Fields> Fields { get { return _fc; } set { _fc = value; } } [DisplayName( "Table Header" )] public HeaderCollection Headers { get { return _hc; } set { _hc = value; } } [DisplayName( "Table Name" )] public string Name { get { return _name; } set { _name = value; } } }
外地类别定义
[Serializable] public class Fields { private string _name = string.Empty; public Guid Key; private List<string> _value = new List<string>(); [Browsable( false )] public List<string> Value { get { return _value; } set { _value = value; } } public Fields() { Key = Guid.NewGuid(); } [DisplayName( "Field Name" )] public string Name { get { return _name; } set { _name = value; } } [DisplayName( "Map" )] public bool Map { get; set; } }
外地班级 显示价值一项或多项的清单。
My Problem is : Need to cross join all values beloging to all fields from a table and display the data in tabular format. I have used this query, but this does not work as it fetch out the values one by one, instead i need a coross join of all values from all fields at one go.
var result = table.SelectMany(
tbl => tbl.Fields.SelectMany(
f => f.Value.Select(v => new { i = v })));
For Example, Lets say :
F1 has Value11
F2 has Value21
F3 has Value31 and Value 32
F4 has Value41, Value42 and Value43
其结果应采用表格的这种格式和所有领域的价值。
Value11 Value21 Value 31 Value 41
Value11 Value21 Value 31 Value 42
Value11 Value21 Value 31 Value 43
Value11 Value21 Value 32 Value 41
Value11 Value21 Value 32 Value 42
Value11 Value21 Value 32 Value 43
让我进一步阐述这一点。 例如,我们
List<string> master = new List<string>();
List<string> child = new List<string>();
List<string> child1 = new List<string>();
List<string> child2 = new List<string>();
and a Linq query to fetch out
var q = from m in master
from c1 in child1
from c in child
from c2 in child2
select new { m, c, c1, c2 };
我确实需要写上上述问题,以勾销外地的价值观,但问题是动态产生的领域,因此,内部的价值观需要某种改观方法或气温克程序,才能取得上述抽样结果。