feat(RSACryptographerList): Die Ausgabe der Indexer-Methode ist nicht null und wirft eine Ausnahme, wenn sie nicht gefunden wird.

This commit is contained in:
Developer 02
2024-12-05 14:33:24 +01:00
parent c96af25e23
commit 738005f5dc
2 changed files with 4 additions and 7 deletions

View File

@@ -15,7 +15,9 @@ namespace DigitalData.Core.Security.Cryptographer
_cryptographers = cryptographers;
}
public TRSACryptographer? this[string key] => _cryptographers.SingleOrDefault(crypt => _keyGenerator(crypt) == key);
public TRSACryptographer this[string key]
=> _cryptographers.SingleOrDefault(crypt => _keyGenerator(crypt) == key)
?? throw new InvalidOperationException($"No {typeof(TRSACryptographer).GetType().Name.TrimStart('I')} found with Key: {key}.");
public IEnumerator<TRSACryptographer> GetEnumerator() => _cryptographers.GetEnumerator();