Compile-Time Safety

Parameter Validation

EasyValidate automatically generates validation methods for your parameters using attributes. See how method parameters are validated at compile-time with zero runtime overhead.

4Examples
4Methods

Real Examples from EasyValidate

See actual parameter validation in action with real code from the EasyValidate test suite.

Basic Parameter Validation
Simple method with NotNull and NotEmpty validation attributes on parameters.
NotNull ValidationNotEmpty ValidationAutomatic GenerationType Safety
Calling Validated Methods
Different ways to call original vs generated validation methods in your code.
Method OverloadingValidation ResultsError HandlingBackward Compatible
Private Method Validation
Static private methods automatically generate validation without ambiguity.
Static MethodsPrivate AccessNo AmbiguityClean API
Generated Validation Logic
See the actual generated validation code for parameter checking and chaining.
Chain ValidationShort-Circuit LogicAttribute CachingDetailed Results

Validation Process Flow

Understand how EasyValidate processes validation chains and handles errors.

Validation Chain Execution
How EasyValidate processes multiple validation attributes in sequence.

Parameter Received

Method parameter with validation attributes is processed

NotNull Check

First validation: ensures parameter is not null

NotEmpty Check

Second validation: ensures string is not empty (only if NotNull passed)

Chain Result

Returns comprehensive validation result with all checks

Error Handling Flow
What happens when validation fails at any step in the chain.

Validation Fails

Any validation attribute returns invalid result

Short-Circuit

Remaining validations are skipped for performance

Error Details

Detailed error information including attribute and value

Result Returned

IValidationResult with IsValid = false and error details