CreditCardAttribute 类

定义

指定数据字段值是信用卡号。

public ref class CreditCardAttribute sealed : System::ComponentModel::DataAnnotations::DataTypeAttribute
[System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property, AllowMultiple=false)]
public sealed class CreditCardAttribute : System.ComponentModel.DataAnnotations.DataTypeAttribute
[<System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property, AllowMultiple=false)>]
type CreditCardAttribute = class
    inherit DataTypeAttribute
Public NotInheritable Class CreditCardAttribute
Inherits DataTypeAttribute
继承
属性

注解

该值使用字符串处理算法进行验证。 该类不验证信用卡号是否对购买有效,只是其格式良好。

构造函数

名称 说明
CreditCardAttribute()

初始化 CreditCardAttribute 类的新实例。

属性

名称 说明
CustomDataType

获取与数据字段关联的自定义字段模板的名称。

(继承自 DataTypeAttribute)
DataType

获取与数据字段关联的类型。

(继承自 DataTypeAttribute)
DisplayFormat

获取数据字段显示格式。

(继承自 DataTypeAttribute)
ErrorMessage

获取或设置一条错误消息,以在验证失败时与验证控件相关联。

(继承自 ValidationAttribute)
ErrorMessageResourceName

获取或设置要使用的错误消息资源名称,以便在验证失败时查找 ErrorMessageResourceType 属性值。

(继承自 ValidationAttribute)
ErrorMessageResourceType

获取或设置在验证失败时用于错误消息查找的资源类型。

(继承自 ValidationAttribute)
ErrorMessageString

获取本地化的验证错误消息。

(继承自 ValidationAttribute)
RequiresValidationContext

获取一个值,该值指示属性是否需要验证上下文。

(继承自 ValidationAttribute)
TypeId

在派生类中实现时,获取此 Attribute的唯一标识符。

(继承自 Attribute)

方法

名称 说明
Equals(Object)

返回一个值,该值指示此实例是否等于指定对象。

(继承自 Attribute)
FormatErrorMessage(String)

根据发生错误的数据字段,将格式应用于错误消息。

(继承自 ValidationAttribute)
GetDataTypeName()

返回与数据字段关联的类型的名称。

(继承自 DataTypeAttribute)
GetHashCode()

返回此实例的哈希代码。

(继承自 Attribute)
GetType()

获取当前实例的 Type

(继承自 Object)
GetValidationResult(Object, ValidationContext)

检查指定的值是否对当前验证属性有效。

(继承自 ValidationAttribute)
IsDefaultAttribute()

在派生类中重写时,指示此实例的值是否为派生类的默认值。

(继承自 Attribute)
IsValid(Object, ValidationContext)

验证与当前验证属性相关的指定值。

(继承自 ValidationAttribute)
IsValid(Object)

确定指定的信用卡号是否有效。

Match(Object)

在派生类中重写时,返回一个值,该值指示此实例是否等于指定对象。

(继承自 Attribute)
MemberwiseClone()

创建当前 Object的浅表副本。

(继承自 Object)
ToString()

返回一个表示当前对象的字符串。

(继承自 Object)
Validate(Object, String)

验证指定的对象。

(继承自 ValidationAttribute)
Validate(Object, ValidationContext)

验证指定的对象。

(继承自 ValidationAttribute)

显式接口实现

名称 说明
_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

将一组名称映射为对应的一组调度标识符。

(继承自 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

检索对象的类型信息,该信息可用于获取接口的类型信息。

(继承自 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

检索对象提供的类型信息接口的数量(0 或 1)。

(继承自 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供对对象公开的属性和方法的访问。

(继承自 Attribute)

适用于