A small set of C# extension methods I've been using on my projects.
This project is target to .NET Standard 2.0 and available as a NuGet package. You can install it using the NuGet Package Console window:
PM> Install-Package LGraebin.Extensions
These are the features available.
You can call IsEmail()
on any string to check if it is a valid e-mail address.
"john.doe@example.com".IsEmail() => true
"@example.com".IsEmail() => false
You can mask the local-part of an e-mail address (the bit before the @-sign) using the MaskEmail()
method. It replaces all characters of the local-part with *
, except the first and last characters.
"john.doe@example.com".MaskEmail() => "j******e@example.com"
If you like or are using this project to learn or start your solution, please give it a star. Thanks!