Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​ComponentModel.​DataAnnotations.​FileExtensionsAttribute

Assembly: System.ComponentModel.Annotations

Inheritance: object → AttributeValidationAttributeDataTypeAttribute → FileExtensionsAttribute

Validates file name extensions.

Properties

public string
Extensions
Gets or sets the file name extensions.
public string
CustomDataType
Gets the name of custom field template that is associated with the data field.
public DataType
DataType
Gets the type that is associated with the data field.
DisplayFormat
Gets a data-field display format.
public string
ErrorMessage
Gets or sets an error message to associate with a validation control if validation fails.
public string
ErrorMessageResourceName
Gets or sets the error message resource name to use in order to look up the <see cref="P:System.ComponentModel.DataAnnotations.ValidationAttribute.ErrorMessageResourceType" /> property value if validation fails.
public Type
ErrorMessageResourceType
Gets or sets the resource type to use for error-message lookup if validation fails.
protected string
ErrorMessageString
Gets the localized validation error message.
public bool
RequiresValidationContext
Gets a value that indicates whether the attribute requires validation context.
public object
TypeId

Methods

public string
FormatErrorMessage​(string name)
Applies formatting to an error message, based on the data field where the error occurred.
Returns The formatted error message.
name The name of the field that caused the validation failure.
public bool
IsValid​(object value)
Checks that the specified file name extension or extensions is valid.
Returns <see langword="true" /> if the file name extension is valid; otherwise, <see langword="false" /> .
value A comma delimited list of valid file extensions.
public string
GetDataTypeName​()
Inherited from DataTypeAttribute
Returns the name of the type that is associated with the data field.
Returns The name of the type associated with the data field.
GetValidationResult​(object value, ValidationContext validationContext)
Inherited from ValidationAttribute
Checks whether the specified value is valid with respect to the current validation attribute.
Returns An instance of the <see cref="T:System.ComponentModel.DataAnnotations.ValidationResult" /> class.
value The value to validate.
validationContext The context information about the validation operation.
protected ValidationResult
IsValid​(object value, ValidationContext validationContext)
Inherited from ValidationAttribute
Validates the specified value with respect to the current validation attribute.
Returns An instance of the <see cref="T:System.ComponentModel.DataAnnotations.ValidationResult" /> class.
value The value to validate.
validationContext The context information about the validation operation.
public void
Validate​(object value, ValidationContext validationContext)
Inherited from ValidationAttribute
Validates the specified object.
value The object to validate.
validationContext The <see cref="T:System.ComponentModel.DataAnnotations.ValidationContext" /> object that describes the context where the validation checks are performed. This parameter cannot be <see langword="null" /> .
public void
Validate​(object value, string name)
Inherited from ValidationAttribute
Validates the specified object.
value The value of the object to validate.
name The name to include in the error message.
public bool
Equals​(object obj)
Inherited from Attribute
public int
GetHashCode​()
Inherited from Attribute
public bool
IsDefaultAttribute​()
Inherited from Attribute
public bool
Match​(object obj)
Inherited from Attribute
protected void
Finalize​()
Inherited from object
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object