-
Notifications
You must be signed in to change notification settings - Fork 33
Equality
skwasjer edited this page Nov 30, 2021
·
12 revisions
Iban
instances can be compared for equality using ==
, !=
or Equals
.
IIbanParser parser = new IbanParser(new IbanValidator());
Iban iban1 = parser.Parse("NL91ABNA0417164300");
Iban iban2 = parser.Parse(" NL91 ABNA 0417 1643 00 ");
Iban iban3 = parser.Parse("BE68 5390 0754 7034");
Debug.WriteLine(iban1 == iban2); // True
Debug.WriteLine(iban1.Equals(iban2)); // True
Debug.WriteLine(iban1 == iban3); // False
Debug.WriteLine(iban1 != iban3); // True
The Iban
type implements GetHashCode()
, and thus can be used as a key for dictionaries.