c# - Maybe incorrect "Possible 'System.NullReferenceException'" tip in Resharper -


I want to iterate a list and want to get label text value. Everything works fine, the relisher tip is expected. Code:

  string someString = GetLocalResourceObject (GetNameAsResource (resourceKey))! = Null? GetLocalResourceObject (GetNameAsResource) ToString (): parametro.Parametro.Nome; In   

and GetLocalResourceObject (GetNameAsResource (resourceKey)) ToString () Resharper suggests: Potential 'System.NullReferenceException' I'm not just doing anything wrong or Resharper Identify previous tap validation?

Tks

Since GetLocalResourceObject () Em> method , the racers do not know that the return value of the second allocation will be equal to the return value from the first orientation! Do this: var resource object = GetLocalResourceObject (GetNameAsResource (resourceKey)); String someString = resourceObject! = Null? ResourceObject.ToString (): parametro.Parametro.Nome;

More warnings will be removed, because now the reporter knows that resourceObject has been checked for meaninglessness before applying a method to it.

It may be better to see - that is, where GetLocalResourceObject currently returns null , instead it represents a 'resource' Do not return any real objects. So you do not want to check this disorder at all.

Comments