Skip to content

Commit 941066e

Browse files
HintSet.HasHints method improvement
Co-authored-by: Aleksandr Ustinov <[email protected]>
1 parent 06d4e28 commit 941066e

File tree

1 file changed

+4
-6
lines changed
  • Orm/Xtensive.Orm/Modelling/Comparison/Hints

1 file changed

+4
-6
lines changed

Orm/Xtensive.Orm/Modelling/Comparison/Hints/HintSet.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,9 @@ public bool HasHints<THint>(Node node)
193193
{
194194
ArgumentValidator.EnsureArgumentNotNull(node, "node");
195195

196-
if (!hintMap.ContainsKey(node))
197-
hintMap.Add(node, new Dictionary<Type, object>());
198-
var nodeHintMap = hintMap.GetValueOrDefault(node);
199-
if (nodeHintMap == null)
200-
return false;
196+
if (!hintMap.TryGetValue(node, out var nodeHintMap)) {
197+
hintMap.Add(node, nodeHintMap = new Dictionary<Type, object>());
198+
}
201199
return nodeHintMap.ContainsKey(typeof(THint));
202200
}
203201

@@ -260,4 +258,4 @@ private HintSet()
260258
{
261259
}
262260
}
263-
}
261+
}

0 commit comments

Comments
 (0)