Cassie Mod

Cassie Mod

  • NA
  • 488
  • 70.4k

filter out nullable UserID LINQ

Jan 15 2018 11:11 AM

HI i want to filter the nullable items out of the groupPhonenumbers, but my linq query doesn't seem to work somehow.
 
the first method groupPhoneNumbers returns a list of a class with 3 items ( 3 phonenumbers). 
 
results: 
[0] --> UserId = "Test_Casper" 
[1]---> UserId = ""
[2] --->UserId = ""
 
// Get all phonenumbers of the group.

var groupPhonenumbers = GroupLogic.GetGroupPhonenumbers(_log, request.requestId, request.sessionId, request.jSessionId, request.ServiceProviderId, request.GroupId, request.Filter, request.StartIndex, request.MaxItems).ToList();

groupPhonenumbers = groupPhonenumbers.Where(gr => (gr.UserId != null) || (gr.UserId != string.Empty)).ToList();

However when i do the where based on a linq query it still shows that twee records, so i;m doing something wrong.  

Answers (1)