A simple library for data validation.
Validation Lib can be installed using one of these commands
PM> Install-Package ValidatorLib> dotnet add package ValidatorLibTests and benchmarks can be found in /src/tests/
var str = "example@email.com";
try
{
Validator.Validate(str).IsEmailAddress();
Validator.Validate(str).MinLength(8);
Validator.Validate(str).IsNotEmpty();
}
catch (ArgumentException e)
{
// If an exception is thrown, the string is not valid
}var str = "example@email.com";
try
{
var validator = new CustomValidator<string>();
validator.AddRule(x => Validator.Validate(x).IsEmailAddress());
validator.AddRule(x => Validator.Validate(x).MinLength(8));
validator.AddRule(x => Validator.Validate(x).IsNotEmpty());
validator.Validate(str);
}
catch (ArgumentException e)
{
// If an exception is thrown, the string is not valid
}For more examples let's see /examples/
For support, email kamilxprorok@gmail.com
If you have any feedback, please reach out to me at kamilxprorok@gmail.com
Contributions are always welcome!
Remember to edit README.md and documentation.md
- Fork the repo on GitHub
- Clone the project to your own machine
- Commit changes to your own branch
- Push your work back up to your fork
- Submit a Pull request so that we can review your changes