new found IsNullOrEmpty bug?

50 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 best solutions below

0
On

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