new found IsNullOrEmpty bug?

35 views Asked by At

below is in a async call and

if (args[0]).ToString() return null, first { will never be reached, and thread seem disapear or blocked.

if (args[0]).ToString() return "", all just behave normal.

  if (string.IsNullOrEmpty( (args[0]).ToString()) )
            {

            }
1

There are 1 answers

0
SLaks On

If args[0] is null, .ToString() will throw a NullReferenceException before you get to call IsNullOrEmpty() on its result.