vb.net linq表达式为C#linq表达 [英] Vb.net linq expression to C# linq express

查看:196
本文介绍了vb.net linq表达式为C#linq表达的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在下面编写了代码,我希望将其转换为c#。任何人都可以帮帮我



我尝试过:



< 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 [ ^ ]

可以转换


有大量的转换器 [ ^ ]!你试过其中任何一个吗?


I have written code below i want to convert it to c# . can anyone help me out

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 convert


There's tons of converters[^]! Have you tried any of them?


这篇关于vb.net linq表达式为C#linq表达的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆