Unosquare
    Show / Hide Table of Contents

    Class MatchAttribute

    Regex validator.

    Inheritance
    Object
    MatchAttribute
    EmailAttribute
    Implements
    IValidator
    Namespace: Swan.Validators
    Syntax
    public class MatchAttribute : Attribute, IValidator

    Constructors

    MatchAttribute(String, String)

    Initializes a new instance of the MatchAttribute class.

    Declaration
    public MatchAttribute(string regex, string errorMessage = null)
    Parameters
    Type Name Description
    String regex

    A regex string.

    String errorMessage

    The error message.

    Properties

    ErrorMessage

    The error message.

    Declaration
    public string ErrorMessage { get; }
    Property Value
    Type Description
    String

    Expression

    The string regex used to find a match.

    Declaration
    public string Expression { get; }
    Property Value
    Type Description
    String

    Methods

    IsValid<T>(T)

    Checks if a value is valid.

    Declaration
    public bool IsValid<T>(T value)
    Parameters
    Type Name Description
    T value

    The value.

    Returns
    Type Description
    Boolean

    True if it is valid.False if it is not.

    Type Parameters
    Name Description
    T

    The type.

    Implements

    IValidator

    Comments

    Back to top Copyright © 2017-2019 Unosquare