Forum General

Help with Linq

VuyiswaMasekoVuyiswaMaseko USMember ✭✭✭
edited February 9 in General

i have ignored Linq for years , today i need to know a few things . i have a function that is defined like this

        public async Task<List<CHAT_MESSAGES_Model>> GetChatListTwoAsync(int USERID)
        { 
            List<CHAT_MESSAGES_Model> lst =await db.Table<CHAT_MESSAGES_Model>().ToListAsync();


            var finallist =  from messages in lst
                               where messages.RECEIVER_USER_ID = USERID
                               where messages.SENDER = USERID
                               select messages ;

            return finallist;
        }

it gives me an error "Severity Code Description Project File Line Suppression State
Error CS0029 Cannot implicitly convert type 'int' to 'bool'"
"

i understand the error but i am not passing any Boolean , its only Integer and also the Property "SENDER " is also Integer

Thanks

Best Answer

  • tareqelzoubitareqelzoubi Member ✭✭
    edited February 9 Accepted Answer

    Hi @VuyiswaMaseko ,
    try to change these lines
    from
    where messages.RECEIVER_USER_ID = USERID
    where messages.SENDER = USERID
    to
    where messages.RECEIVER_USER_ID == USERID
    where messages.SENDER == USERID

Answers

Sign In or Register to comment.