osyris zosar

osyris zosar

  • NA
  • 289
  • 27.5k

if statement in LINQ?

Jan 6 2021 12:52 AM
i have a couple of list but sometimes they are empty 

  1. var matching = from name in indexnames  
  2.                            from surname in indexsurname  
  3.                            from age in agesurname  
  4.                            from height in indexheight  
  5.                            where name.Equals(surname) &&   
  6.                                                  name.Equals(age) && name.Equals(height)  
  7.                           orderby name  
  8.                           select name;  
How can i make sure it only does name.Equals(value) if it actualy contains anything ?

Answers (1)