The following code example demonstrates a shared Boolean property, itemRemoved, a shared CacheItemRemovedReason enumeration object, reason, and a CacheItemRemovedCallback delegate, onRemove. The latter can be included in an Insert or Add method call. It also defines a method, RemovedCallback, with a signature that matches the CacheItemRemovedCallback delegate. When the RemovedCallback method is called, it changes the itemRemoved property value to true and assigns the reason property value to the reason provided by the CacheItemRemovedReason enumeration.
|
Shared itemRemoved As boolean = false
Shared reason As CacheItemRemovedReason
Dim onRemove As CacheItemRemovedCallback
Public Sub RemovedCallback(k As String, v As Object, r As CacheItemRemovedReason)
itemRemoved = true
reason = r
End Sub
|
|
static bool itemRemoved = false;
static CacheItemRemovedReason reason;
CacheItemRemovedCallback onRemove = null;
public void RemovedCallback(String k, Object v, CacheItemRemovedReason r){
itemRemoved = true;
reason = r;
}
|
|
static var itemRemoved : boolean = false;
static var reason : CacheItemRemovedReason;
var onRemove : CacheItemRemovedCallback = null;
public function RemovedCallback(k : String, v : Object, r : CacheItemRemovedReason){
itemRemoved = true;
reason = r;
}
|