asp.net mvc - Linq a.Metadata.ToLower().Contains -


i have problem list of objects, 1 have field example metadata, null. when use a.metadata.tolower().contains(sometext) shows me error, null value. how can fix ? p.s. see problem first time, tried same other list of objects 1 have null fields , works, can problem ?

instead of

.where(a => a.metadata.tolower().contains(sometext)) 

do

.where(a => a.metadata != null && a.metadata.tolower().contains(sometext)) 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -