下面是IsNullOrEmpty()错误行 [英] IsNullOrEmpty() error line below

查看:78
本文介绍了下面是IsNullOrEmpty()错误行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码,用于将我从数据库中检索到的值分配给DTO成员。但这不是问题,真正的问题是当我使用下面的IsNullOrEmpty()时,它会变成我的代码下面的红线。当我搜索其他函数/方法时,IsNullOrEmpty()看起来很好,下面没有红线。我可以知道这种或错误的解决方案吗?

谢谢。



以下是我的代码:



有红线:

  //   CustomerAssembly = Model / Part Number  
dto = new LabelPrintDataDto();
dto.Key = $ CustAssNumber $;
dto.Value =(!unitdto.PartNumberCustomer.IsNullOrEmpty()) // < - 错误在这里
? unitdto.PartNumberCustomer
string .Empty;
labelPrintDataListDto.DtoList.Add(dto);







没有红线:

  //   CustomerAssembly =型号/部件号 
dto = new LabelPrintDataDto();
dto.Key = $ CustAssNumber $;
dto.Value =(!unitdto.PartNumberCustomer.IsNullOrEmpty())
? unitdto.PartNumberCustomer
string .Empty;
labelPrintDataListDto.DtoList.Add(dto);







两者都是相同的代码在不同的方法/函数中。

错误消息是没有verload方法'IsNullOrEmpty取0参数'

解决方案

CustAssNumber


;
dto.Value =(!unitdto.PartNumberCustomer.IsNullOrEmpty()) // < span class =code-comment>< - error here
?unitdto.PartNumberCustomer
string .Empty;
labelPrintDataListDto.DtoList.Add(dto);







没有红线:

  //   CustomerAssembly =型号/部件号 
dto = new LabelPrintDataDto();
dto.Key =

CustAssNumber

Hi, I have the following codes which is to assign a value that I retrieved from database into a DTO member. But this is not the problem, the real problem is when I use "IsNullOrEmpty()" as below, it become red line below of my codes. While I search through the other function/method, the "IsNullOrEmpty()" seems fine and have NO red line below. May I know any solution for this kind or error?
Thank you.

Below are my codes:

Has red line:

//CustomerAssembly = Model/Part Number
dto = new LabelPrintDataDto();
dto.Key = "$CustAssNumber$";
dto.Value = (!unitdto.PartNumberCustomer.IsNullOrEmpty()) //<-- error here
            ? unitdto.PartNumberCustomer
            : string.Empty;
labelPrintDataListDto.DtoList.Add(dto);




NO red line:

//CustomerAssembly = Model/Part Number
dto = new LabelPrintDataDto();
dto.Key = "$CustAssNumber$";
dto.Value = (!unitdto.PartNumberCustomer.IsNullOrEmpty())
            ? unitdto.PartNumberCustomer
            : string.Empty;
labelPrintDataListDto.DtoList.Add(dto);




Both are same codes just reside in diferent method/function.
The error message is "No verload method 'IsNullOrEmpty that take 0 arguments'"

解决方案

CustAssNumber


"; dto.Value = (!unitdto.PartNumberCustomer.IsNullOrEmpty()) //<-- error here ? unitdto.PartNumberCustomer : string.Empty; labelPrintDataListDto.DtoList.Add(dto);




NO red line:

//CustomerAssembly = Model/Part Number
dto = new LabelPrintDataDto();
dto.Key = "


CustAssNumber


这篇关于下面是IsNullOrEmpty()错误行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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