Table of Contents

Class VknAttribute

Namespace
HeroKit.Validation
Assembly
HeroKit.dll

Validates a Turkish tax number (Vergi Kimlik No) with IsValidVkn(string?).

[AttributeUsage(AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Parameter, AllowMultiple = false)]
public sealed class VknAttribute : ValidationAttribute
Inheritance
VknAttribute
Inherited Members
Extension Methods

Examples

public sealed class Customer
{
    [Required, Vkn]
    public string? Value { get; set; }
}

Remarks

Null and empty values are valid; combine with RequiredAttribute to require a value. Non-string values are invalid.

Constructors

VknAttribute()

Initializes the attribute with the default error message: "The {0} field must be a valid Turkish tax number (VKN)."

public VknAttribute()

Methods

IsValid(object?)

Determines whether the specified value of the object is valid.

public override bool IsValid(object? value)

Parameters

value object

The value of the object to validate.

Returns

bool

true if the specified value is valid; otherwise, false.

Exceptions

InvalidOperationException

The current attribute is malformed.

NotImplementedException

Neither overload of IsValid has been implemented by a derived class.