Struct SepaCreditorID
Helper class for working with a SEPA Creditor Identifier.
public struct SepaCreditorID
- Inherited Members
Constructors
SepaCreditorID(string)
public SepaCreditorID(string sCreditorID)
Parameters
sCreditorID
stringThe creditor ID. If this is
null
or an empty string, then this will be a Null creditor ID. Use Capture(string) in order to pre-process a user entered creditor ID.
Exceptions
- ArgumentException
The given creditor ID string was not a syntactically correct creditor ID (i.e. IsValid(string) returns
false
on it.
Fields
MAXLENGTH
The maximum length of any creditor identifier.
public const int MAXLENGTH = 35
Field Value
MINLENGTH
The minimum length of any creditor identifier.
public const int MINLENGTH = 8
Field Value
Null
Represents an unset SepaCreditorID instance.
public static readonly SepaCreditorID Null
Field Value
Properties
CountryCode
Provides the country code portion of this SEPA Creditor Identifier.
public string CountryCode { get; }
Property Value
CreditorID
Provides the wrapped SEPA Creditor Identifier.
public string CreditorID { get; }
Property Value
IsNull
Indicates whether this SEPA Creditor Identifier is Null.
public bool IsNull { get; }
Property Value
Methods
Capture(string)
Captures a creditor ID entered by the user, removing whitespace and converting lower case to upper case.
public static string Capture(string sCreditorId)
Parameters
sCreditorId
string
Returns
- string
If the parameter sCreditorId was
null
or an empty string, then the return value will benull
.
Remarks
Any non alphanumeric characters, such as whitespace or symbols, are removed from the captured creditor ID.
Any lower case letters are converted into upper case letters.
IsValid(string)Equals(object)
Compares the SEPA Creditor Identifier for equivalence.
public override bool Equals(object obj)
Parameters
obj
objectRight hand side to compare to.
Returns
- bool
True if both are essentially the same SEPA Creditor Identifier.
Format(string)
Nicely formats the given creditor ID input into groups.
public static string Format(string sCreditorId)
Parameters
sCreditorId
string
Returns
GetCountryCode(string)
Returns the country code portion of the given SEPA Creditor Identifier.
public static string GetCountryCode(string sCreditorID)
Parameters
sCreditorID
stringThe creditor ID to extract the country code from.
Returns
- string
If the given creditor ID was
null
or an empty string, thennull
is returned. Otherwise the first two characters from the string are returned.
Exceptions
- ArgumentException
The given creditor ID was not a valid string.
GetHashCode()
Provides an hash code based on the SEPA Creditor Identifier.
public override int GetHashCode()
Returns
- int
Hashcode.
IsValid(string)
Tests whether a string is a valid SEPA Creditor Identifier.
public static bool IsValid(string sCreditorID)
Parameters
sCreditorID
string
Returns
SameCreditor(SepaCreditorID, SepaCreditorID)
Compares the given creditor IDs without the contained creditor business code.
public static bool SameCreditor(SepaCreditorID tCreditorID1, SepaCreditorID tCreditorID2)
Parameters
tCreditorID1
SepaCreditorIDtCreditorID2
SepaCreditorID
Returns
SameCreditor(string, string)
Compares the given creditor IDs without the contained creditor business code.
public static bool SameCreditor(string sCreditorID1, string sCreditorID2)
Parameters
Returns
ToString()
Returns the SEPA Creditor Identifier.
public override string ToString()
Returns
- string
SEPA Creditor Identifier.
Operators
operator ==(SepaCreditorID, SepaCreditorID)
Equality operator compares the SEPA Creditor Identifier.
public static bool operator ==(SepaCreditorID lhs, SepaCreditorID rhs)
Parameters
lhs
SepaCreditorIDrhs
SepaCreditorID
Returns
operator !=(SepaCreditorID, SepaCreditorID)
Inequality operator compares the SEPA Creditor Identifier.
public static bool operator !=(SepaCreditorID lhs, SepaCreditorID rhs)
Parameters
lhs
SepaCreditorIDrhs
SepaCreditorID