Reporter | Igor Abade (t-shooter) |
---|---|
Created | Jul 26, 2007 9:48:13 PM |
Updated | Apr 13, 2018 3:33:27 PM |
Resolved | Apr 13, 2018 3:33:24 PM |
Subsystem | Code Analysis |
Assignee | Ilya Ryzhenkov (orangy) |
Priority | Normal |
State | Fixed |
Type | Feature |
Fix version | Unidentified prior version |
Affected versions | No Affected versions |
Fixed In Version ReSharper | Undefined |
VsVersion | All Versions |
Much like the "Check if is null" code suggestion, a "Check if has key" suggestion, invoked in an expression invoking the indexer of a dictionary:
Given the following code:
Given the following code:
Dictionary<string,string> dict;If the user invoked the "Check if has key" code suggestion, then the following code would be generated:
string value = dict["mykey"];
Dictionary<string,string> dict;
if (dict.ContainsKey("mykey"))
{
string value = dict["mykey"];
}