R# 3.0 (#460) Value analysis

I have next code:

string nameValue = null;
Values.TryGetValue(key, out value);

if (nameValue != null) // on this line - Expression is always false
{
...
}




0
5 comments
Avatar
Permanently deleted user

What is 'Values'? And isn't it marked by 'NotNull' attribute?

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Alexander Nesterenko" <framework3705@mail.ru> wrote in message
news:57490f098f758c97d51eb83900e@news.jetbrains.com...
>I have next code:
>

string nameValue = null;
Values.TryGetValue(key, out value);

>

if (nameValue != null) // on this line - Expression is always false
{
...
}

>
>



0
Avatar
Permanently deleted user

What is 'Values'? And isn't it marked by 'NotNull' attribute?


Values is property of the type System.Collections.Generic.SortedDictionary<TKey,TValue>


0
Avatar
Permanently deleted user

Hello Alexander,

If there is no typo in the post, it is correct. You have "out value", which
doesn't change "nameValue".

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


AN> I have next code:
AN>
AN> string nameValue = null;
AN> Values.TryGetValue(key, out value);
AN> if (nameValue != null) // on this line - Expression is always false
AN> {
AN> ...
AN> }


0
Avatar
Permanently deleted user

Hello Alexander,

If there is no typo in the post, it is correct. You have "out value",
which doesn't change "nameValue".


Thanks, it's typo :)


0
Avatar
Permanently deleted user

All is OK. You pass 'value' as out-argument, and then check other variable
'nameValue'

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Alexander Nesterenko" <framework3705@mail.ru> wrote in message
news:57490f098f758c97d51eb83900e@news.jetbrains.com...
>I have next code:
>

string nameValue = null;
Values.TryGetValue(key, out value);

>

if (nameValue != null) // on this line - Expression is always false
{
...
}

>
>



0

Please sign in to leave a comment.