Probably the analyser is not smart enough in this case. Maybe you can help it:
var names = vcards[i].DisplayName;
if( names != null )
{
foreach( var displayName in names )
. . .
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am checking a property for null, but Visual Studio then warns me about a possibly null reference.
I am explicitly checking that the DisplayNames property is not null before enumerating it.
Please enlighten me as to what I am doing wrong, if anything.
Thank you.
Probably the analyser is not smart enough in this case. Maybe you can help it:
var names = vcards[i].DisplayName;
if( names != null )
{
foreach( var displayName in names )
. . .