0

I am trying to check if a field is Null or Empty.

I have the following script:

  return db.Clients.Where(a => string.IsNullOrEmpty(a.ClientName) == false)
                   .OrderBy(a => a.ClientName);

It seems to work as expected. I was wondering if the above is the most efficient or if there may be some gottchas that I may not be aware of in using what I have above that may lead to issues.

4

1 に答える 1

1

AFAIK, String.IsNullOrEmpty cannot be translated, therefor it can be faster to check for null and empty manually and seperately.

于 2012-09-17T16:41:05.840 に答える