Class EmailNormalizer
Utility class for normalizing email addresses to ensure consistent storage and comparison.
public static class EmailNormalizer
- Inheritance
-
objectEmailNormalizer
Methods
Normalize(string)
Normalizes an email address to lowercase and trims whitespace.
public static string Normalize(string email)
Parameters
emailstringThe email address to normalize.
Returns
- string
The normalized (lowercase, trimmed) email address.
Exceptions
- ArgumentException
Thrown when the email is null or whitespace.
NormalizeOrNull(string?)
Normalizes an email address to lowercase and trims whitespace, or returns null if the input is null or whitespace.
public static string? NormalizeOrNull(string? email)
Parameters
emailstringThe email address to normalize, or null/whitespace.
Returns
- string
The normalized (lowercase, trimmed) email address, or null if the input was null or whitespace.