我有这样的疑问:
var result = from tsr in db.tsr
where tsr.SomeId = x
where tsr.Sequence > ((from tsr2 in db.tsr where tsr2.SomeId = y where tsr2.FitId = tsr.FitId select tsr2.Sequence)).FirstOrDefault()
select new MyClass()
{
Properties = tsr.properties // (simplicified)
}
我想知道如何在我的tsr2.Sequence
对象中选择NewClass
值?
答案 0 :(得分:0)
select new MyClass(){
MyClass.Property1 = tsr.Sequence.PropertyX,
MyClass.Property2 = tsr.Sequence.PropertyY,
MyClass.Property3 = tsr.Sequence.PropertyZ,
......
}
您可以逐个选择和分配属性。并确保您的MyClass对象属性是公共的