{
object secondary;
int entryIndex = FindEntry(key, out secondary);
- value = (TValue)secondary;
+ value = JitHelpers.UnsafeCast<TValue>(secondary);
return entryIndex != -1;
}
{
for (int entriesIndex = _buckets[bucket]; entriesIndex != -1; entriesIndex = _entries[entriesIndex].Next)
{
- TKey thisKey = (TKey)_entries[entriesIndex].depHnd.GetPrimary();
+ TKey thisKey = JitHelpers.UnsafeCast<TKey>(_entries[entriesIndex].depHnd.GetPrimary());
if (thisKey != null)
{
list.Add(thisKey);
// expired key as a live key with a null value.)
if (primary != null)
{
- list.Add((TValue)secondary);
+ list.Add(JitHelpers.UnsafeCast<TValue>(secondary));
}
}
}
if (Equals(thisKey, key))
{
GC.KeepAlive(this); // ensure we don't get finalized while accessing DependentHandles.
- value = (TValue)thisValue;
- return (TKey)thisKey;
+ value = JitHelpers.UnsafeCast<TValue>(thisValue);
+ return JitHelpers.UnsafeCast<TKey>(thisKey);
}
}
}