=== Code examples

==== Noncompliant code example

[source,vbnet,diff-id=1,diff-type=noncompliant]
----
Function UpdateValue(dict As ConcurrentDictionary(Of Integer, Integer), key As Integer) As Integer
    Return dict.GetOrAdd(key, Function(k)
                                   Return key + 42
                               End Function)
End Function
----

==== Compliant solution

[source,vbnet,diff-id=1,diff-type=compliant]
----
Function UpdateValue(dict As ConcurrentDictionary(Of Integer, Integer), key As Integer) As Integer
    Return dict.GetOrAdd(key, Function(k)
                                   Return k + 42
                               End Function)
End Function
---- 
