public void Resize(int newSize)
 {
     newSize++; // Slot 0 should always be empty.
     CredentialSlot[] newSlots = new CredentialSlot[newSize];
     Array.Copy(_slots, newSlots, Math.Min(_slots.Length, newSize));
     _slots = newSlots;
 }
 public bool TrySetCredential(int index, CredentialSlot slot)
 {
     if (index <= 0 || index >= _slots.Length)
     {
         return false;
     }
     _slots[index] = slot;
     return true;
 }
 public bool TryGetCredential(int index, out CredentialSlot slot)
 {
     if (index <= 0 || index >= _slots.Length)
     {
         slot = null;
         return false;
     }
     slot = _slots[index];
     return slot != null;
 }