Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Operator '==' cannot be applied to operands of type 'method group' and 'string'

I am receiving an "Operator '==' cannot be applied to operands of type 'method group' and 'string'" error on the third line of this code and I do not know why.

where (PRIORITiesItem.Prioid == null || PRIORITiesItem.Prioid.Contains("1%")) 
    && (SITEItem.Id == "TH" || SITEItem.Id == "NM")  
--> && (sv.Glseg.TrimStart == "703" || sv.Glseg.TrimStart == "704" || sv.Glseg.TrimStart == "705")        
    && (CREWItem.Crewid == null || !CREWItem.Crewid.Contains("2-%") && CREWItem.Crewid.Contains("MAINT") 
        || (CREWItem.Crewid.Contains("ELECT") || CREWItem.Crewid.Contains("INST")
    && !WORKORDERTYPEItem.Id.Contains("Standing")))

At first I thought that maybe it didn't like "==" so I chnaged it with "=" but that wasn't the problem. besides, the line right above it uses "==" and it works just fine. Glseg is a field within a table, not a method so it must not like the string. Does anyone have any ideas where I am going wrong?

like image 499
Programming Newbie Avatar asked Nov 30 '22 02:11

Programming Newbie


1 Answers

In C#, those methods have to be called with ():

str.TrimStart() == "bla"
like image 192
Mr. TA Avatar answered Apr 25 '23 06:04

Mr. TA