Which of the below is better in performance using LINQ?
sets.FirstOrDefault(x=>x.name=="xxx")
or
sets.FirstOrDefault(x=>!string.IsNullOrEmpty(x.name) && x.name.Equals("xxx",StringComparison.InvariantCultureIgnoreCase));
Here name can be null
. I'm using this kind of query 20+ times in my app.
Is there any better approach?