如何在C#linq中使用显式类型转换

时间:2015-07-12 06:09:37

标签: c#

我应该尝试这段代码但它无法正常工作。请在此代码上提供解决方案

 var patientList = (from b in GBill.GetList()
                           join p in GPatient.GetList()                               
                           on b.PatientId equals p.patientid

                           select new { 
                                        patientid = p.patientid,
                                        patientName = p.patientName,
                                        address = p.address,
                                        age = p.age,
                                        BillId = b.BillId,
                                        GrandTotal = b.GrandTotal,
                                        salutation= p.salutation =="Mr."?"Male":"FeMale",
                                        VisitNo = b.VisitNo ==Convert.ToInt32( b.VisitNo >1 ? "Old" : "New")
                           }).ToList();

在访问号码

时显示错误

enter image description here

0 个答案:

没有答案