SHARE
TWEET

Untitled

a guest Apr 13th, 2019 109 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Friend Class TCache(Of K, V)
  2.     Inherits Dictionary(Of K, V)
  3.  
  4.     Private ReadOnly finder As Func(Of K, V)
  5.  
  6.     Sub New(finder As Func(Of K, V))
  7.         Me.finder = finder
  8.     End Sub
  9.  
  10.     Default Public Shadows ReadOnly Property Item(key As K) As V
  11.         Get
  12.             Item = Nothing
  13.             If Me.TryGetValue(key, Item) Then Return Item
  14.             Item = Me.finder(key)
  15.             Me.Add(key, Item)
  16.         End Get
  17.     End Property
  18.  
  19. End Class
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top