【发布时间】:2016-05-06 07:35:52
【问题描述】:
问题
这个错误刚刚开始出现在我的项目中,我不确定原因。我有一个生成文件的“Silverlight 5”项目文件。此文件包含 MatchTimeoutInMilliseconds 调用,似乎一直出错:
'System.ComponentModel.DataAnnotations.RegularExpressionAttribute' does not contain a definition for 'MatchTimeoutInMilliseconds'
我不知道如何解决这个问题,因为它与我编写的代码无关。
代码
/// <summary>
/// Gets or sets the 'uEmail' value.
/// </summary>
[DataMember()]
[DataType(DataType.EmailAddress)]
[Display(Name="Email address")]
[RegularExpression("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\." +
")+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$", ErrorMessage="Please enter a valid e-mail adress", MatchTimeoutInMilliseconds=-1)]
[Required()]
[StringLength(256)]
public string uEmail
{
}
上面是包含错误的代码。
有谁知道我该如何解决这个问题?
【问题讨论】:
-
MatchTimeoutInMilliseconds 属性仅从 .NET 4.6.1 开始可用。看来您使用的是旧版本的框架。
标签: c# code-generation system.componentmodel