vb.net linq表达式为C#linq表达 [英] Vb.net linq expression to C# linq express
问题描述
我在下面编写了代码,我希望将其转换为c#。任何人都可以帮帮我 I have written code below i want to convert it to c# . can anyone help me out 这篇关于vb.net linq表达式为C#linq表达的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
我尝试过:
< pre lang =vb.net> Dim query = from order In Temp_Data.AsEnumerable()。Where ( Function (x)x.Field( Of String )( VesselType)= param_vesseltype 和 x.Field( String )( VoyageType)= param_voyagetype)
组订单按VesselID = order.Field( Of 字符串)( VesselID),VesselName = order.Field( of 字符串)( VesselName)进入g =组
选择 新 使用 {
.VesselName = VesselName,
.VesselId = VesselID,
.tot_ifo = g.Sum(功能(订单)订单。字段( Double )( < span class =code-string> Tot_Ifo)),
.tot_ifols = g.Sum( Function (order)order.Field ( Double )( Tot_Ifols)),
.tot_mdols = g.Sum( Function (order)order.Field( of Double )( Tot_mdols)),
。 tot_mdo = g.Sum(功能(订单)order.Field( Double )( Tot_mdo)),
.Co2 = g.Sum( Function (order)order.Field( Of Double )( Co2)),
.Nox = g.Sum( Function (order)order.Field( of 双跨度>) ( Nox)),
.Sox = g.Sum(功能(订单)order.Field( Double )( Sox))
} 尝试ILSpy_Master_2.3.1.1855_Binaries
ILSpy [ ^ ]
可以转换
有大量的转换器 [ ^ ]!你试过其中任何一个吗?
What I have tried:
Dim query = From order In Temp_Data.AsEnumerable().Where(Function(x) x.Field(Of String)("VesselType") = param_vesseltype And x.Field(Of String)("VoyageType") = param_voyagetype)
Group order By VesselID = order.Field(Of String)("VesselID"), VesselName = order.Field(Of String)("VesselName") Into g = Group
Select New With {
.VesselName = VesselName,
.VesselId = VesselID,
.tot_ifo = g.Sum(Function(order) order.Field(Of Double)("Tot_Ifo")),
.tot_ifols = g.Sum(Function(order) order.Field(Of Double)("Tot_Ifols")),
.tot_mdols = g.Sum(Function(order) order.Field(Of Double)("Tot_mdols")),
.tot_mdo = g.Sum(Function(order) order.Field(Of Double)("Tot_mdo")),
.Co2 = g.Sum(Function(order) order.Field(Of Double)("Co2")),
.Nox = g.Sum(Function(order) order.Field(Of Double)("Nox")),
.Sox = g.Sum(Function(order) order.Field(Of Double)("Sox"))
}
TRY ILSpy_Master_2.3.1.1855_Binaries
ILSpy[^]
Can do convertThere's tons of converters[^]! Have you tried any of them?