If null then set it to empty string lambda expression in linq
<p>Im having a foreach loop that looks like this:   </p>

<pre><code> foreach (var item in listOfFieldNames)
                {
    list.Where(s =&gt;  s.GetType().GetProperty(item).GetValue(s, null).ToString().ToLower().Contains(searchString.ToLower()));
}
</code></pre>

<p>and it works pretty well, but whenever "s" is a null I get nullRefferenceException</p>

<p>I would like to change my s = null into s = " " but I don't know how to do it.
Could you guys help me?
Or maybe there is a method to skip that null record and continue my loop without getting an exception. That would also help me.</p>

<p>Trying to figure this out for quite some time and can't find the answer anywhere :/
Tried some .DefaultIfEmpty combinations but I don't think I know what to put inside it</p>